<img src="images/Story/menu.png" width=80%>
<i><h3>
The following game is a work of fiction. Destined to Ascend is a game with a lot of erotic content.
Are you over legal age and friendly with the content of that game?</h3></i>
<<link "Yes" "Opening and Name">><<set $knownRecipes.push($strengthboostrecipe1)>><<set $difficulty to null>><</link>>
<a href="https://www.google.com/">No</a>
<<nobr>>
<<set $skillInventory.push($soulflareReversal)>>
<<set $skillInventory.push($stoneheartConstitution)>>
<<set $skillInventory.push($heavenSplittingPalm)>>
<</nobr>><div class="main-menu-container">
<h2 class="main-title">Path of Ascension</h2>
<div class="progress-hint">
<<if $mainStageStarted neq "true">>
<p>You are still wandering the mortal world.<br>
<strong>Explore the map</strong> and seek your destiny.</p>
<<elseif $CurrentPcMainSect is "">>
<p>Your foundation is laid, but you walk alone.<br>
<strong>Seek out a sect</strong> to join a greater path.</p>
<<elseif $CurrentPcSectRank in ["Initiate", "Disciple", "Inner Disciple"]>>
<p>You have entered <<print $CurrentPcMainSect>>, but your standing is low.<br>
<strong>Rise through the ranks</strong> - become a Core or True Disciple.</p>
<<else>>
<p>You are a <<print $CurrentPcSectRank>> of <<print $CurrentPcMainSect>>.<br>
<strong>Await word from your master</strong> - greater trials approach.</p>
<</if>>
</div>
<<nobr>>
<div class="tab-nav">
<<link "Achievements">><<goto "Achievements">><</link>>
<<link "Status">><<goto "Status">><</link>>
<<link "Skills">><<goto "Skills">><</link>>
<<link "Inventory">><<goto "Inventory">><</link>>
<<link "Relations">><<goto "Relations">><</link>>
<<link "Breakthrough">><<goto "Breakthrough">><</link>>
<<link "Help">><<goto "Help">><</link>>
</div>
<</nobr>>
<<link "Return" $passage>><</link>>
</div><<nobr>>
<<if $pe eq 0>>
<<audio "background1" volume 0.2 play loop>>
<br><img src="images/Story/intro.jpg" class=center width="60%">
<<run Dialog.setup("Movement & Skills")>>
<<run Dialog.wiki("You can move around the map using <b>WASD</b> keys.<br><br> Before engaging in battles, make sure to equip your skills! After you finish the prologue, open the <b>Skills</b> tab (bottom of the screen) to prepare your abilities.")>>
<<run Dialog.open()>>
<br>The wind howled like a crying ghost as dusk fell over the broken ridges of Mount Yunsu. You had come here chasing whispers—rumors of spirit beasts and hidden herbs—but found something far beyond the mundane.
<br>
<br>From behind a cluster of jagged boulders, you watched in awe and terror as two figures clashed mid-air—one cloaked in black flame, the other wrapped in blinding golden radiance. Swords hummed with killing intent, Qi tore through the sky, and even the clouds trembled. A battle between cultivators of opposing sects: one clearly righteous, the other reeking of demonic aura.
<br>
<br>As the duel reached its climax, the heavens themselves roared.
<br>
<br>Suddenly, the sky darkened. Black thunderclouds surged, lightning coiling like serpents. A blinding pillar of light struck between them, forcing both to crash to the earth. And from that split in the heavens… something impossible emerged.
<br>
<br>A mythical dragon, scaled in starlight and shadow, descended with a roar that shook your soul. The cultivators, powerful as they were, stood no chance. Their bodies, burned and bloodied, now lie in the clearing before you—half-dead, half-conscious. Their swords broken, their treasures scattered, their pride shattered.
<br>
<br>And now… they are within your reach.
<br>
<br>Observe [[righteous cultivator->Intro][$pe=2]] / [[demonic cultivator->Intro][$pe=3]]
<br>Help [[righteous cultivator->Intro][$pe=4]] / [[demonic cultivator->Intro][$pe=5]]
<br>Kill [[righteous cultivator->Intro][$pe=6]] / [[demonic cultivator->Intro][$pe=7]]
<<set $hasHelped to null>>
<<set $helpGiven to null>>
<<set $hasKilled1 to null>>
<<set $hasKilled2 to null>>
<<elseif $pe eq 2>>
<<if $hasKilled1 eq 1>><<else>><img src="images/Story/intro1.jpg" class=center width="60%">
<br>You approach the wounded woman wrapped in white robes. Despite the blood crusted on her lips and the scorched symbols along her sleeves, her aura still pulses with a righteous glow. A badge lies near her hand—<b>Clear Sky Azure Dragon Pavilion</b>, a prestigious clan known for defending mortals from demonic beasts.
<br>
<br>Even now, her fingers twitch as if prepared to summon a final technique.
<br>
<br>Do you:
<br>
<br><<if $hasHelped is true>>You’ve already drained your Qi. You cannot help another.
<br><<else>>Help [[righteous cultivator->Intro][$pe=4]]<</if>>
<br><<if $helpGiven eq "righteous">><<else>>Kill [[righteous cultivator->Intro][$pe=6]]<</if>><</if>>
<br>Return to observe [[demonic cultivator->Intro][$pe=3]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<br>
<br><<elseif $pe eq 3>><<if $hasKilled2 eq 1>><<else>>
<br><img src="images/Story/intro2.jpg" class=center width="60%">
<br>The man in black robes coughs violently, blood and bile leaking from his lips. Despite his wounds, his eyes flicker with cruel cunning. His Qi is wild—corrupted. A broken pendant rests beside him: the sigil of the <b>Ghost King Netherworld Sect</b>.
<br>
<br>Yet something about the way he clutches a charm in his hand feels... personal.
<br>
<br>Do you:
<br>
<br><<if $hasHelped is true>>You’ve already drained your Qi. You cannot help another.
<br><<else>>Help [[demonic cultivator->Intro][$pe=5]] <</if>>
<br><<if $helpGiven eq "evil">><<else>>Kill [[demonic cultivator->Intro][$pe=7]]<</if>><</if>>
<br>Return to observe [[righteous cultivator->Intro][$pe=2]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<<elseif $pe eq 4>>
<<set $hasHelped to true>>
<<set $helpGiven to "righteous">>
<br>You kneel beside her and press your palm to her back. Your Qi flows into her shattered meridians, stabilizing her foundation. She coughs blood, then gasps sharply as the pain fades.
<br>Her eyes flutter open—golden irises lock with yours. <span class="righteous">“You... saved me,”</span> she whispers.
<br>She presses a jade token into your hand.
<br><span class="righteous">“Take this. If you ever seek the <b>Clear Sky Azure Dragon Pavilion</b>, they will receive you.”</span>
<br>
<br>You are too drained to help another.
<<set $recommendationLetter to "righteous">>
<br>Return to observe [[demonic cultivator->Intro][$pe=3]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<<elseif $pe eq 5>>
<<set $hasHelped to true>>
<<set $helpGiven to "evil">>
<br>You crouch by his side, ignoring the corrupted aura. Focusing your Qi, you guide it into his mangled dantian. He groans, then snarls back to life—eyes glowing with crimson light.He coughs, then tosses you a blood-stained token.
<br><span class="demonic">“You're not like the others. If you want power… come to the <b>Ghost King Netherworld Sect</b>.”</span>
<br>
<br>You feel dizzy—there’s no way you could stabilize another after this.
<<set $recommendationLetter to "evil">>
<br>Return to observe [[righteous cultivator->Intro][$pe=2]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<<elseif $pe eq 6>>
<br>She tries to lift her head, eyes dazed. Your blade finds her throat before she can speak.
<br>
<br>It’s quick. Her blood steams in the cold mountain air.
<br>
<br>Among her shattered belongings, you find rare herb and some spirit stones. A cache worthy of a true cultivator.
<<gainRandomItem>> <<set $gold+=random(150,350)>>
<<set $hasKilled1 to 1>>
<br>Return to observe [[demonic cultivator->Intro][$pe=3]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<<elseif $pe eq 7>>
<br>He senses your approach—too late. Your strike pierces his heart with precision.
<br>
<br>He gurgles a curse and slumps back, lifeless. The dark mist around him vanishes.
<br>
<br>You rummage through his possessions: rare herb and some spirit stones.
<br>
<<gainRandomItem>> <<set $gold+=random(150,350)>>
<<set $hasKilled2 to 1>>
<br>Return to observe [[righteous cultivator->Intro][$pe=2]]
<br><<if $hasHelped neq null or $helpGiven neq null or $hasKilled1 neq null or $hasKilled2 neq null>><<link "Continue" "Map|Region1">><</link>> with your journey!<</if>>
<</if>>
<<set $playerX = 0>>
<<set $playerY = 13>>
<<set _tileSize = 50>>
<<set _x = $playerX * _tileSize>>
<<set _y = $playerY * _tileSize>>
<<set $map = [
[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[1,1,1,1,1,1,0,0,0,2,2,0,0,-1],
[1,1,1,1,1,1,0,0,0,2,2,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,3,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,2,0,0,0,0,0,0,0,0,0,0,-1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,-1]
]>>
<<set $CurrentPcSectRank to "">>
<</nobr>><<set $playername to "Ziyan">>
<<set $playersurname to "Bai">>
Welcome in <b><i>The Destined to Ascend</i></b>!
To begin, first select difficulty, then click 'Continue'.
<table class="stat-table">\
<tr>\
<th>Easy</th>
<th>Normal</th>
<th>Hard</th>
</tr>
<tr>
<td>
<b>🌍World</b>: Qi: High, Herb: High, Ore: High, Price: Low
<b>🧍♂️Character</b>: Initial stats: 150%, Higher grade of nature, ressurection stones = 9
<b>👹Monsters</b>: Monster HP: 75%, Monster damage: 75%, Monster ammount: Less frequent
<<link "Choose this difficulty" "Opening and Name">><<set $difficulty to "easy">><</link>>
</td>
<td>
<b>🌍World</b>: Qi: Normal, Herb: Normal, Ore: Normal, Price: Normal
<b>🧍♂️Character</b>: Initial stats: 100%, Standard grade of nature, ressurection stones = 6
<b>👹Monsters</b>: Monster HP: 100%, Monster damage: 100%, Monster ammount: Standard
<<link "Choose this difficulty" "Opening and Name">><<set $difficulty to "normal">><</link>>
</td>
<td>
<b>🌍World</b>: Qi: Low, Herb: Low, Ore: Low, Price: High
<b>🧍♂️Character</b>: Initial stats: 75%, Standard grade of nature, ressurection stones = 3
<b>👹Monsters</b>: Monster HP: 125%, Monster damage: 125%, Monster ammount: More frequent
<<link "Choose this difficulty" "Opening and Name">><<set $difficulty to "hard">><</link>>
</td>
</tr>
</table>
<<if $difficulty eq null>>Please select difficulty to continue.<<else>> Selected difficulty: <b>$difficulty</b>. <<link "Continue?" "Character Creation">><</link>><</if>><<nobr>>
<<if $verystart eq 0>><<else>>\
<br><b>Name</b>: $playerfullname
<br><<UpdatePortrait>>
<<if $activeSideMission neq null>>
<br><b>Current Mission:</b> <<print $activeSideMission.name>>
<</if>>
<br><b><<link "📖 Journal" "Journal">><</link>></b>
<div id="stats-recovery">
<<statusCondition>>
</div>
<br><b>Corruption</b>: $corruption
<br><b>Experience</b>: <<print $exp.toFixed(2)>>
\
<</if>>
<div class="volume-container" style="margin-top:15px; text-align:center;">
<span style="font-size:10px; color:#b8860b; text-transform:uppercase;">Spirit Ambience</span><br>
<<volume>>
</div>
<</nobr>><<include Stats>>
<<include Naming>>
<<include Destiny>>
<<include PlayerI>>
<<include Items>>
<<include NPC>>
<<include AlchemyItems>>
<<include Potions>>
<<include PotionRecipes>>
<<include SideMissions>>
<<include SpecialArts>>
<<include Dtalks>>
<<include MainMissions>>
<<include MerchantItems>>
<<include WorldState>>
<<set _bgm = setup.SoundPath + "background1.mp3">>
<<cacheaudio "background1" _bgm>>
<<set _bgm = setup.SoundPath + "background2.mp3">>
<<cacheaudio "background2" _bgm>>
<<set $CurrentGameVersion to 0.16>>
<<set $gameVersion to 0.16>><<set $worldState to {
activeWar: null, /* Stores { sideA: "", sideB: "", endTurn: 0 } */
forbiddenZoneOpen: 0, /* Turn number when a zone closes */
globalCalamity: false
}>><<if $a eq 0>>
<<nobr>>
<div class="flex-container"><img src="images/Character/fmc.png" style="float: left;"><div>
<br><b>Surname:</b> $playersurname <b>Lifespan</b> : $lifespan / $maxlifespan
<br><b>Name:</b> $playername <b>Sex</b>: Female
<br><b>Charisma:</b>
<br><b>Realm:</b> <<cultivationStatus>>
<br><b>Internal Trait:</b> <span id="internalDisplay"><<= $internalTrait>></span>
<br><<for _index, _trait range $internalOptions>>
<<capture _t = _trait>>
<<link _trait>><<set $internalTrait to _trait>>
<<replace "#internalDisplay">><<=$internalTrait>>
<</replace>>
<</link>>
<</capture>>
<</for>>
<br><b>External Trait:</b> <span id="externalDisplay"><<= $externalTrait>></span>
<br><<for $index, _trait range $externalOptions>>
<<capture _t=_trait>>
<<link _trait>><<set $externalTrait to _trait>>
<<replace "#externalDisplay">><<=$externalTrait>>
<</replace>>
<</link>>
<</capture>>
<</for>>
</div>
<</nobr>>
<div style="text-align: center;">
Please choose your desired traits!
<<link "Stats" "Character Creation 2">><<set $a to 1>><</link>></div>
<<elseif $a eq 1>>
<div style="display: flex; align-items: center; gap: 20px;">
/* COLUMN 1: THE IMAGE */
<div style="flex: 0 0 auto;">
<img src="images/Character/fmc.png" style="max-height: 500px; display: block;">
</div>
<<ConstitutionCalc>>
/* COLUMN 2: THE DESTINY SELECTION */
<div style="flex: 1;">
<b><<link "⟳" "Character Creation 2">> <<set $destinyList.shuffle()>><<set $playerDestiny = []>><<updateDestinyStats>><</link>> Destiny </b>
<i>selected destinies:</i>
<span style="display: inline-block; margin-left: 10px;">
<<nobr>>
<<for _a to 0; _a lt $playerDestiny.length; _a++>>
<span style="margin-right: 10px;">
<<print _a + 1>>.
<<capture _a>>
<<link $playerDestiny[_a].name "Character Creation 2">>
<<set $playerDestiny.delete($playerDestiny[_a])>>
<<updateDestinyStats>>
<</link>>
<</capture>>
</span>
<</for>>
You have awakened the <<hovertip $constitutionDesc>><b>$constitutionName</b>!
<</hovertip>>
<</nobr>>
</span>
<div style="margin-top: 20px;">
<<nobr>>
<table style="width: 100%; table-layout: fixed; border-collapse: collapse;">
<tr>
<<for _d to 0; _d lt 4; _d++>>
<<set _destiny = $destinyList[_d]>>
<<capture _d, _destiny>>
<<set _statMap = {
"destinyatk": "Attack", "destinydef": "Defense", "destinycrit": "Critical Rate",
"destinycritres": "Crit Resist", "destinyagility": "Agility", "destinymartialArts": "Martial Arts",
"destinyspiritualRoot": "Spiritual Root", "righteousreputation": "Righteous Rep",
"demonicreputation": "Demonic Rep", "destinylifespan": "Lifespan",
"destinyenergy": "Energy", "destinyhealth": "Health"
}>>
<<set _tip = '<div style="width:300px; margin-bottom: 5px;">' + _destiny.description + '</div><hr><div style="display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 300px; font-size: 0.9em;">'>>
<<for _key, _label range _statMap>>
<<if _destiny[_key] !== 0>>
<<set _val = _destiny[_key]>>
<<set _color = (_val > 0 ? "#7fff00" : "#ff4500")>>
<<set _tip += '<span>' + _label + ': <b style="color:' + _color + ';">' + (_val > 0 ? "+" : "") + _val + '</b></span>'>>
<</if>>
<</for>>
<<set _tip += '</div>'>>
<td style="text-align: center; vertical-align: top; padding: 10px 2px;">
<<hovertip _tip>>
<div style="display: flex; flex-direction: column; align-items: center; min-height: 100px;">
<span style="font-size: 1.5em; margin-bottom: 8px;">
<<if _destiny.rarity is "Red">>🔴<<elseif _destiny.rarity is "Purple">>🟣<<elseif _destiny.rarity is "Orange">>🟠<<elseif _destiny.rarity is "Grey">>⚪<<elseif _destiny.rarity is "Green">>🟢<<elseif _destiny.rarity is "Blue">>🔵<</if>>
</span>
<<set _alreadyChosen to false>>
<<for _i to 0; _i lt $playerDestiny.length; _i++>>
<<if $playerDestiny[_i].name == _destiny.name>>
<<set _alreadyChosen to true>>
<</if>>
<</for>>
<div style="width: 90px; font-size: 0.85em; line-height: 1.2; overflow-wrap: break-word;">
<<if not _alreadyChosen>>
<<link _destiny.name "Character Creation 2">>
<<if $playerDestiny.length < 3>>
<<set $playerDestiny.push(_destiny)>>
<<updateDestinyStats>>
<</if>>
<</link>>
<<else>>
<span style="opacity: 0.4; filter: grayscale(100%);">_destiny.name</span>
<</if>>
</div>
</div>
<</hovertip>>
</td>
<</capture>>
<</for>>
</tr>
</table>
<</nobr>>
</div>
</div>
</div>
<p>
<table class="small-table">
<tr>
<th>General</th>
<th>Combat</th>
</tr>
<tr>
<td>
<br><b>🧬 Lifespan:</b> <<=$lifespan>> / <<=$maxlifespan>>
<br><b>❤️ Health:</b> <<=$health>> / <<=$maxhealth>>
<br><b>⚡ Energy:</b> <<=$energy>> / <<=$maxenergy>>
<br><b>🍀 Luck:</b> <<=$luck>>
<br><b>🧠 Insight:</b> <<=$insight>>
<br><b>💪 Strength:</b> <<=$basestrength>>
<br><b>🌀 Willpower:</b> <<=$basewillpower>>
<br><b>🧘♂️ Energy Recovery:</b> <<print $energyRecovery * 100>>%
</td>
<td>
<br><b>🗡️ Attack:</b> <<=$atk>>
<br><b>🛡️ Defense:</b> <<=$def>>
<br><b>💥 Crit Rate:</b> <<=$crit>>%
<br><b>🛑 Crit Resist</b>: <<=$critres>>%
<br><b>👟 Agility</b>: <<=$agility>>
<br><b>🥋 Martial Arts:</b> <<=$martialArts>>
<br><b>🌌 Spiritual Root:</b> <<=$spiritualRoot>>
<br><b>🩸 Health Recovery:</b> <<print $healthRecovery * 100>>%
</td>
</tr>
</table></p><</if>>
<<if $playerDestiny.length eq 3>><<link "Continue" "Intro">><<set $pe to 0>><<set $verystart to 1>><</link>><</if>>\
<div class="name-box">
<p>Enter your name and surname, or let fate decide.</p>
<<textbox "$playersurname" $playersurname>> <<link "<b>⟳</b>">> <<set $playersurname to $playersurnameList.random()>> <<run document.getElementById("textbox-playersurname").value = SugarCube.State.active.variables.playersurname>><</link>>
<<textbox "$playername" $playername>> <<link "<b>⟳</b>">> <<set $playername to $playernameList.random()>> <<run document.getElementById("textbox-playername").value = SugarCube.State.active.variables.playername>><</link>>
<div class="name-button">
<<link "Use This Name">>
<<goto "Character Creation 2">><<set $a to 0>>
<</link>>
</div>
</div>
<<set $internalTrait to $internalOptions.random()>>
<<set $externalTrait to $externalOptions.random()>><<widget "SoulflareReversal">>
Your soul ignites like a phoenix ember as you defy fate itself! Time rewinds and death is denied.
<<AbilityImagex $ability 250>><</AbilityImagex>>
<<set $health = $health + $maxhealth * 0.3>>
<<set $soulflareUsed = true>>
You restore 30% of your health and resist death!
<<if $abilitylevel gte 2>>
<<set _reflected = $enemyatk * 0.5>>
<<set $enemycurrenthealth -= _reflected>>
You reflect $_reflected damage back to the enemy!
<</if>>
<</widget>>
<<widget "HeavenSplittingPalm">>
You summon your spiritual energy into your palm and unleash a Heaven-Splitting strike that shakes the heavens!
<<AbilityImagex $ability 250>><</AbilityImagex>>
<<set $defPierce = $currentEnemy.NPCdef * 0.5>>
<<set $abilityvalue = ($baseatk * 1.8) - $defPierce>>
<<if $abilitylevel gt 1>>
<<set $abilityvalue += 0.2 * $basestrength * $abilitylevel>>
<</if>>
You deal <<print $abilityvalue.toFixed(2)>> damage, ignoring part of enemy defense!
<<set $currentEnemy.NPCcurrenthealth -= $abilityvalue>>
<<if $abilitylevel gte 3 and random(1, 100) lte 25>>
<<set $enemyStaggered = true>>
The enemy is staggered and loses their next action!
<</if>>
<</widget>>
<<widget "StoneheartConstitution">>
You draw upon the tempered strength of your Stoneheart Constitution.
<<set $passivedef += 5 + ($level * 2)>>
Your base defense has increased by <<print 5 + ($activePassiveLevel * 2)>> points!
<</widget>>
<<widget "VenomFangSlash">>
You lunge forward with a venomous claw strike, leaving a lingering poison!
<<AbilityImagex $ability 250>><</AbilityImagex>>
<<set $defPierce = $currentEnemy.NPCdef * 0.3>>
<<set $abilityvalue = ($baseatk * 1.5) - $defPierce>>
You slash the enemy for $abilityvalue damage!
<<set $currentEnemy.NPCcurrenthealth -= $abilityvalue>>
<<set _poisonDmg = 0.05 * $maxhealth>>
The enemy is poisoned, taking $_poisonDmg damage over time!
<<if $abilitylevel gte 2>>
<<set _critChance = 20>>
<<if random(1,100) lte _critChance>>
<<set $critBonus = $abilityvalue * 0.5>>
Critical strike! You deal an extra $critBonus damage!
<<set $currentEnemy.NPCcurrenthealth -= $critBonus>>
<</if>>
The poison lasts longer at this level!
<</if>>
<</widget>>
<<widget "UnholyEndurance">>
You embrace the corruption within, hardening your body against pain.
<<set $passivedef += 10 + (2 * $abilitylevel)>>
Your defense rises by <<print 10 + (2 * $abilitylevel)>> points!
<<if $abilitylevel gte 2>>
<<set $resistStatus = true>>
You gain resistance to weakening and harmful effects!
<</if>>
<</widget>>
<<widget "BloodCurseMark">>
You carve a sigil of blood into the air, cursing your foe with dark power!
<<AbilityImagex $ability 250>><</AbilityImagex>>
<<set $abilityvalue = ($basemaxenergy * 2) - ($currentEnemy.NPCdef * 0.4)>>
You sacrifice health to empower the curse.
<<set $health -= 0.1 * $maxhealth>>
You lose 10% of your health but deal $abilityvalue damage!
<<set $currentEnemy.NPCcurrenthealth -= $abilityvalue>>
The enemy is cursed — their healing is reduced, and they take extra damage!
<<if $abilitylevel gte 2>>
The curse lingers longer and grows more vicious!
<</if>>
<<if $abilitylevel gte 3 and random(1,100) lte 30>>
Dark power spreads! Another nearby foe is also afflicted!
<</if>>
<</widget>>
<<widget "FallingStarPalm">>
You channel power into your palm and strike down like a blazing star, shattering the ground!
<<AbilityImagex $ability 250>><</AbilityImagex>>
<<set $defPierce = $currentEnemy.NPCdef * 0.4>>
<<set $abilityvalue = ($baseatk * 1.6) - $defPierce>>
You deal $abilityvalue damage with explosive force!
<<set $currentEnemy.NPCcurrenthealth -= $abilityvalue>>
<<if $abilitylevel gte 2>>
The strike’s impact radiates outward, hitting nearby foes for <<print $abilityvalue * 0.5>> splash damage!
<</if>>
<</widget>>
<<widget "RadiantLotus">>
A lotus of radiant qi blooms within you, harmonizing body and spirit.
Your healing effects are increased by <<print 10 + (5 * ($abilitylevel - 1))>>%!
<<if $abilitylevel gte 2>>
Your inner clarity strengthens, slightly improving your energy recovery!
<</if>>
<</widget>>
<<widget "HeavenwardBarrier">>
You raise a shield of celestial light, warding off death itself!
<<AbilityImagex $ability 250>><</AbilityImagex>>
The barrier will block a single fatal strike and restore health when triggered.
<<if $abilitylevel gte 2>>
The shield grows stronger, restoring more health when it activates!
<</if>>
<<if $abilitylevel gte 3>>
The celestial shield also reflects part of the blocked damage back at the attacker!
<</if>>
<</widget>><<link "Return" $passage>><</link>>
<<nobr>>
<div class="achievements-container">
<h2 class="achievements-title">Heavenly Records</h2>
<p class="achievements-count">
Unlocked: <<print State.variables.achievements.length>> / <<print window.achievementsList.length>>
</p>
<div class="achievements-scroll">
<<set _sortedList to window.getSortedAchievements()>>
<<set _unlocked to State.variables.achievements>>
<<for _ach range _sortedList>>
<<if _unlocked.includes(_ach.id)>>
<div class="achievement-item unlocked">
<div class="achievement-name"><<print _ach.title>></div>
<div class="achievement-desc"><<print _ach.desc>></div>
</div>
<<else>>
<div class="achievement-item locked">
<div class="achievement-name">???</div>
<div class="achievement-desc">A hidden truth awaits...</div>
</div>
<</if>>
<</for>>
</div>
<<link "Return" $passage>><</link>>
</div>
<div class="tab-nav">
<<link "Achievements" "Achievements">><</link>><<link "Status">><<goto "Status">><</link>><<link "Skills">><<goto "Skills">><</link>><<link "Inventory">><<goto "Inventory">><</link>><<link "Relations">><<goto "Relations">><</link>><<link "Breakthrough">><<goto "Breakthrough">><</link>><<link "Help">><<goto "Help">><</link>>
</div>
<</nobr>><<link "Go back" $passage>><</link>>
<<nobr>><<StatsUpdater>>
<div class="breakthrough-container">
<div class="breakthrough-header">
<h2>Breakthrough</h2>
<p>Channel your qi, face the heavens, and ascend to new heights!</p>
</div>
<img src="images/Story/breakthrough.png" class="breakthrough-portrait" alt="Cultivation Breakthrough">
<<Breakthrough>>
</div>
<</nobr>>
<div class="tab-nav">
<<link "Status">><<goto "Status">><</link>><<link "Skills">><<goto "Skills">><</link>><<link "Inventory">><<goto "Inventory">><</link>><<link "Relations">><<goto "Relations">><</link>><<link "Breakthrough">><<goto "Breakthrough">><</link>><<link "Help">><<goto "Help">><</link>>
</div><<BreakthroughEvent>>rarity(high to low) - red, purple, orange, grey, green, blue
<<set $playerDestiny to []>>
BLANKDESTINY = [
{
"name": "NAME",
"rarity": "COLOR",
"description": "DESCRIPTION",
"destinyatk": 0,
"destinydef": 0,
"destinycrit": 0,
"destinycritres": 0,
"destinyagility": 0,
"destinymartialArts": 0,
"destinyspiritualRoot": 0,
"righteousreputation": 0,
"demonicreputation": 0,
"destinylifespan": 0,
"destinyenergy": 0,
"destinyhealth": 0,
<<set $destinyList to [
{
"name": "Child of Flame",
"rarity": "Red",
"description": "Born with the power of fire. Your soul burns brighter than others.",
"destinyatk": 5,
"destinydef": 2,
"destinycrit": 3,
"destinycritres": 0,
"destinyagility": 1,
"destinymartialArts": 0,
"destinyspiritualRoot": 5,
"righteousreputation": 5,
"demonicreputation": 0,
"destinylifespan": 0,
"destinyenergy": 10,
"destinyhealth": 0,
"essence": "Fire"
},
{
"name": "Silent Blade",
"rarity": "Blue",
"description": "Trained in the shadows, you strike before anyone senses danger.",
"destinyatk": 3,
"destinydef": 1,
"destinycrit": 5,
"destinycritres": 2,
"destinyagility": 5,
"destinymartialArts": 4,
"destinyspiritualRoot": 0,
"righteousreputation": 0,
"demonicreputation": 5,
"destinylifespan": 0,
"destinyenergy": 5,
"destinyhealth": 0,
"essence": "Martial"
},
{
"name": "Heaven's Oracle",
"rarity": "Purple",
"description": "Blessed with divine foresight, your insight shapes the world.",
"destinyatk": 1,
"destinydef": 0,
"destinycrit": 0,
"destinycritres": 3,
"destinyagility": 0,
"destinymartialArts": 0,
"destinyspiritualRoot": 8,
"righteousreputation": 10,
"demonicreputation": 0,
"destinylifespan": 50,
"destinyenergy": 20,
"destinyhealth": 0,
"essence": "Heaven"
},
{
"name": "Cursed Survivor",
"rarity": "Grey",
"description": "You lived, but something dark clings to your soul.",
"destinyatk": 2,
"destinydef": 3,
"destinycrit": 0,
"destinycritres": 4,
"destinyagility": 1,
"destinymartialArts": 1,
"destinyspiritualRoot": 0,
"righteousreputation": -5,
"demonicreputation": 10,
"destinylifespan": -10,
"destinyenergy": 0,
"destinyhealth": 20,
"essence": "Demonic"
},
{
"name": "Wandering Fist",
"rarity": "Green",
"description": "A martial nomad who trains endlessly under the open sky.",
"destinyatk": 3,
"destinydef": 3,
"destinycrit": 2,
"destinycritres": 1,
"destinyagility": 3,
"destinymartialArts": 6,
"destinyspiritualRoot": 0,
"righteousreputation": 3,
"demonicreputation": 0,
"destinylifespan": 10,
"destinyenergy": 5,
"destinyhealth": 10,
"essence": "Martial"
},
{
"name": "Undying Will",
"rarity": "Orange",
"description": "Even death cannot stop your pursuit of purpose.",
"destinyatk": 2,
"destinydef": 5,
"destinycrit": 0,
"destinycritres": 5,
"destinyagility": 0,
"destinymartialArts": 2,
"destinyspiritualRoot": 3,
"righteousreputation": 0,
"demonicreputation": 5,
"destinylifespan": 100,
"destinyenergy": 0,
"destinyhealth": 30,
"essence": "Body"
},
{
"name": "Scholar of Forbidden Tomes",
"rarity": "Purple",
"description": "You’ve studied secrets mortals weren’t meant to know.",
"destinyatk": 0,
"destinydef": 1,
"destinycrit": 2,
"destinycritres": 2,
"destinyagility": 0,
"destinymartialArts": 0,
"destinyspiritualRoot": 10,
"righteousreputation": -3,
"demonicreputation": 10,
"destinylifespan": 60,
"destinyenergy": 30,
"destinyhealth": -10,
"essence": "Mind"
},
{
"name": "Mountainheart",
"rarity": "Blue",
"description": "You are as resilient and unyielding as stone.",
"destinyatk": 2,
"destinydef": 8,
"destinycrit": 0,
"destinycritres": 5,
"destinyagility": -2,
"destinymartialArts": 2,
"destinyspiritualRoot": 0,
"righteousreputation": 3,
"demonicreputation": 0,
"destinylifespan": 20,
"destinyenergy": 0,
"destinyhealth": 30,
"essence": "Earth"
},
{
"name": "Eyes of the Hawk",
"rarity": "Green",
"description": "Nothing escapes your gaze, no motion goes unnoticed.",
"destinyatk": 1,
"destinydef": 1,
"destinycrit": 6,
"destinycritres": 1,
"destinyagility": 4,
"destinymartialArts": 2,
"destinyspiritualRoot": 1,
"righteousreputation": 0,
"demonicreputation": 0,
"destinylifespan": 0,
"destinyenergy": 0,
"destinyhealth": 0,
"essence": "Spirit"
},
{
"name": "Golden Child",
"rarity": "Orange",
"description": "You were born destined for greatness. The heavens favor you.",
"destinyatk": 3,
"destinydef": 3,
"destinycrit": 3,
"destinycritres": 3,
"destinyagility": 3,
"destinymartialArts": 3,
"destinyspiritualRoot": 3,
"righteousreputation": 10,
"demonicreputation": 0,
"destinylifespan": 50,
"destinyenergy": 15,
"destinyhealth": 15,
"essence": "Heaven"
},
{
"name": "Corrupt Apostle",
"rarity": "Red",
"description": "You speak for powers from beyond. Their whispers guide you.",
"destinyatk": 5,
"destinydef": 0,
"destinycrit": 4,
"destinycritres": 0,
"destinyagility": 1,
"destinymartialArts": 2,
"destinyspiritualRoot": 7,
"righteousreputation": -15,
"demonicreputation": 25,
"destinylifespan": 10,
"destinyenergy": 20,
"destinyhealth": 0,
"essence": "Demonic"
},
{
"name": "Beastkin Bloodline",
"rarity": "Grey",
"description": "Somewhere in your ancestry, a feral power sleeps.",
"destinyatk": 4,
"destinydef": 2,
"destinycrit": 2,
"destinycritres": 1,
"destinyagility": 4,
"destinymartialArts": 4,
"destinyspiritualRoot": -1,
"righteousreputation": -2,
"demonicreputation": 2,
"destinylifespan": -5,
"destinyenergy": 0,
"destinyhealth": 15,
"essence": "Beast"
},
{
"name": "Royal Lineage",
"rarity": "Purple",
"description": "Blue blood flows through your veins. Expectations weigh heavily.",
"destinyatk": 2,
"destinydef": 3,
"destinycrit": 2,
"destinycritres": 2,
"destinyagility": 2,
"destinymartialArts": 1,
"destinyspiritualRoot": 4,
"righteousreputation": 7,
"demonicreputation": -1,
"destinylifespan": 10,
"destinyenergy": 10,
"destinyhealth": 10,
"essence": "Heaven"
},
{
"name": "Exiled Monk",
"rarity": "Green",
"description": "Once devoted, now wandering and awakened by hardship.",
"destinyatk": 1,
"destinydef": 2,
"destinycrit": 0,
"destinycritres": 3,
"destinyagility": 3,
"destinymartialArts": 6,
"destinyspiritualRoot": 2,
"righteousreputation": 4,
"demonicreputation": 0,
"destinylifespan": 10,
"destinyenergy": 5,
"destinyhealth": 10,
"essence": "Spirit"
},
{
"name": "Soul Parasite",
"rarity": "Red",
"description": "You survived something you shouldn’t have. It still lives in you.",
"destinyatk": 6,
"destinydef": 0,
"destinycrit": 3,
"destinycritres": 0,
"destinyagility": 1,
"destinymartialArts": 0,
"destinyspiritualRoot": 8,
"righteousreputation": -10,
"demonicreputation": 20,
"destinylifespan": -20,
"destinyenergy": 20,
"destinyhealth": -10,
"essence": "Demonic"
},
{
"name": "Frostborn Nomad",
"rarity": "Blue",
"description": "Raised in cold silence, your heart beats like permafrost.",
"destinyatk": 3,
"destinydef": 5,
"destinycrit": 1,
"destinycritres": 4,
"destinyagility": 2,
"destinymartialArts": 1,
"destinyspiritualRoot": 1,
"righteousreputation": 1,
"demonicreputation": 0,
"destinylifespan": 5,
"destinyenergy": 5,
"destinyhealth": 10,
"essence": "Ice"
}
]>><<nobr>>
<div class="journal-container">
<h2>✦ The Scribe's Journal ✦</h2>
<!-- Filters -->
<div class="journal-filters">
<label>Filter by type:</label>
<select id="journal-filter-type">
<option value="all">All</option>
<option value="grudge">Grudges</option>
<option value="sex">Sexual Encounters</option>
<option value="combat">Combat & Deaths</option>
<option value="reputation">Reputation</option>
<option value="breakthrough">Breakthroughs</option>
<option value="cultivation">Cultivation</option>
<option value="story">Story Events</option>
<option value="mission">Missions</option>
</select>
<label>Sort by:</label>
<select id="journal-sort">
<option value="newest">Newest first</option>
<option value="oldest">Oldest first</option>
<option value="importance">Importance (high to low)</option>
</select>
<<if $journalEntries.length gt 0>>
<span class="journal-count">Total entries: <<print $journalEntries.length>></span>
<</if>>
</div>
<div id="journal-list">
<<if $journalEntries.length eq 0>>
<p class="empty-journal">The pages are blank... go make history!</p>
<<else>>
<<for _i = 0; _i lt $journalEntries.length; _i++>>
<<set _entry to $journalEntries[_i]>>
<div class="journal-entry importance-<<print _entry.importance>>" @data-type="_entry.type" @data-importance="_entry.importance" @data-timestamp="_entry.timestamp">
<div class="journal-header">
<span class="journal-icon">
<<if _entry.type eq "grudge">>⚔️
<<elseif _entry.type eq "sex">>❤️🔥
<<elseif _entry.type eq "combat">>⚔️
<<elseif _entry.type eq "reputation">>📢
<<elseif _entry.type eq "breakthrough">>🌊
<<elseif _entry.type eq "cultivation">>🧘
<<elseif _entry.type eq "story">>📜
<<elseif _entry.type eq "mission">>📋
<<else>>📖<</if>>
</span>
<span class="journal-title"><<print _entry.title>></span>
<span class="journal-date">
<<if _entry.age>>
Age <<print _entry.age>>
<<else>>
Turn <<print _entry.turn>>
<</if>>
</span>
</div>
<div class="journal-description">
<<print _entry.description>>
<<if _entry.location>>
<br><span class="journal-location">📍 <<print _entry.location>></span>
<</if>>
</div>
<<if _entry.relatedNPCName>>
<div class="journal-related">
👤 <<if _entry.relatedNPC and !$known_npc_list.find(function(n) { return n.id === _entry.relatedNPC and n.isDead; })>>
<<link _entry.relatedNPCName "RelationsDetailed">>
<<set $selectedNPCid to _entry.relatedNPC>>
<</link>>
<<else>>
<<print _entry.relatedNPCName>>
<<if $known_npc_list.find(function(n) { return n.id === _entry.relatedNPC and n.isDead; })>>
<span class="dead-tag">(Deceased)</span>
<</if>>
<</if>>
</div>
<</if>>
</div>
<</for>>
<</if>>
</div>
<div class="journal-footer">
<<link "Back" $passage>><</link>>
</div>
</div>
<<script>>
/* Debug version: logs data-type of each entry to browser console */
$(document).ready(function() {
var $typeSelect = $('#journal-filter-type');
var $sortSelect = $('#journal-sort');
if (!$typeSelect.length || !$sortSelect.length) return;
function filterAndSort() {
var type = $typeSelect.val();
var sort = $sortSelect.val();
var $entries = $('.journal-entry');
/* Log each entry's data-type to help debug filtering */
console.log("Selected filter: " + type);
$entries.each(function() {
console.log(" Entry data-type: " + $(this).data('type'));
});
/* Filter by type (show/hide) */
$entries.each(function() {
var $entry = $(this);
if (type === 'all' || $entry.data('type') === type) {
$entry.show();
} else {
$entry.hide();
}
});
/* Get visible entries */
var visible = $entries.filter(':visible').toArray();
/* Sort visible by selected criteria */
if (sort === 'newest') {
visible.sort(function(a, b) {
return $(b).data('timestamp') - $(a).data('timestamp');
});
} else if (sort === 'oldest') {
visible.sort(function(a, b) {
return $(a).data('timestamp') - $(b).data('timestamp');
});
} else if (sort === 'importance') {
visible.sort(function(a, b) {
return $(b).data('importance') - $(a).data('importance');
});
}
/* Reorder DOM: detach all entries, then append visible in order, then hidden */
var $allEntries = $('.journal-entry');
$allEntries.detach();
var $container = $('#journal-list');
visible.forEach(function(entry) {
$container.append(entry);
});
/* Append hidden entries after visible (so they stay in container but are hidden) */
$entries.filter(':hidden').each(function() {
$container.append(this);
});
}
$typeSelect.on('change', filterAndSort);
$sortSelect.on('change', filterAndSort);
filterAndSort(); /* initial filter & sort */
});
<</script>>
<</nobr>><<set $playeriteminventory to []>>
<<set $playerpotioninventory to []>>
<<set $playerspecialskill to []>>
<<set $playerpassiveskill to []>>
<<set $playerattackskill to []>>
<<set $knownRecipes = []>>
<<set $pcsidemissions = []>>
<<set $craft = false>>
<<set $spiritpavilion to 0>>
<<set $journalEntries = []>>
<<set $nextJournalId = 0>>
<<set $realmIndexMap = {
"Mortal": { "": 0 },
"Body Tempering Realm": 1,
"Meridian Awakening Realm": 2,
"Qi Condensation Realm": 3,
"Foundation Establishment Realm": 4,
"Core Formation Realm": 5,
"Nascent Soul Realm": 6
}>>
<<set $stageIndexMap = {
"Early": 0,
"Middle": 1,
"Late": 2
}>>
<<set $cultivationRealms = ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm", "Foundation Establishment Realm", "Core Formation Realm", "Nascent Soul Realm"]>>
<<set $cultivationStages = ["Early", "Middle", "Late"]>>
<<set $realmIndex = $realmIndexMap[$cultivationRealm]>>
<<set $stageIndex = $stageIndexMap[$cultivationStage]>>
<<set $requiredExp = 1000 * (1 + $realmIndexMap[$cultivationRealm]) * (1 + $stageIndexMap[$cultivationStage])>>
<<set $relationPage to 1>>
/* ITEMS */
/* ==================== OUTER ROBES ==================== */
<<set $simplerobes to {
name: "Simple Robes",
description: "Plain yet comfortable robes woven from spirit cotton. Light and easy to move in.",
stats: { agility: 1, willpower: 1, armor: 3 },
price: 80,
sellprice: 20,
class: "robe",
durability: 100,
maxDurability: 100,
corruptionLock: 0
}>>
<<set $travelerscloak to {
name: "Traveler's Cloak",
description: "A sturdy hooded cloak that shields against wind and minor qi fluctuations.",
stats: { willpower: 2, armor: 4 },
price: 150,
sellprice: 35,
class: "robe",
durability: 120,
maxDurability: 120,
corruptionLock: 0
}>>
<<set $cloudsilkgown to {
name: "Cloud-Silk Gown",
description: "Light as mist, this flowing gown allows qi to circulate freely through the body.",
stats: { agility: 2, willpower: 3, armor: 3 },
price: 320,
sellprice: 80,
class: "robe",
durability: 90,
maxDurability: 90,
corruptionLock: 0
}>>
<<set $phoenixfeatherrobe to {
name: "Phoenix Feather Robe",
description: "Soft crimson feathers shimmer faintly. Grants minor resistance to fire qi.",
stats: { strength: 1, agility: 1, willpower: 4, armor: 5 },
price: 680,
sellprice: 170,
class: "robe",
durability: 110,
maxDurability: 110,
corruptionLock: 0
}>>
<<set $nakedState to {
name: "Naked State",
description: "No robes or protection - bare skin exposed to the elements and prying eyes. A bold choice for the corrupted.",
stats: {},
price: 0,
sellprice: 0,
class: "naked",
corruptionLock: 95,
equipped: false,
durability: 0,
maxDurability: 0
}>>
/* ==================== UNDERWEAR ==================== */
<<set $silkunderrobe to {
name: "Silk Underrobe",
description: "Smooth silk worn beneath outer robes. Simple and comfortable.",
stats: { healthRecovery: 0.02 }, /* +2% health recovery */
price: 50,
sellprice: 10,
class: "underwear",
corruptionLock: 0
}>>
<<set $jadelotuslingerie to {
name: "Jade Lotus Lingerie",
description: "Delicate jade-green silk embroidered with tiny lotuses. Enhances yin essence flow and allure.",
stats: { agility: 1, charisma: 3 },
price: 280,
sellprice: 70,
class: "underwear",
lewd: true,
corruptionLock: 0
}>>
<<set $crimsonphoenixpanties to {
name: "Crimson Phoenix Panties",
description: "Fiery red silk that warms the lower dantian. Increases sensitivity and agility.",
stats: { agility: 2, pleasureBonus: 5 },
price: 220,
sellprice: 55,
class: "underwear",
lewd: true,
corruptionLock: 0
}>>
<<set $moonlightveil to {
name: "Moonlight Veil Underwear",
description: "Nearly transparent silver threads. Calms the mind and boosts willpower during intimate moments.",
stats: { willpower: 3 },
price: 350,
sellprice: 85,
class: "underwear",
lewd: true,
corruptionLock: 0
}>>
<<set $noUnderwear to {
name: "No Underwear",
description: "Wearing robes without undergarments - a daring and slightly indecent freedom that stirs dark desires.",
stats: {},
price: 0,
sellprice: 0,
class: "underwear",
corruptionLock: 45,
equipped: false,
durability: 0,
maxDurability: 0
}>>
/* ==================== ACCESSORIES ==================== */
<<set $jadehairpin to {
name: "Jade Hairpin",
description: "A simple jade hairpin that keeps stray thoughts at bay.",
stats: { willpower: 2, insight: 1 },
price: 120,
sellprice: 30,
class: "accessory"
}>>
<<set $spiritbellanklet to {
name: "Spirit Bell Anklet",
description: "Tiny silver bells chime softly with every step, sharpening footwork.",
stats: { agility: 3 },
price: 180,
sellprice: 45,
class: "accessory"
}>>
<<set $goldenwaistchain to {
name: "Golden Waist Chain",
description: "A delicate chain that rests on the hips. Visible when robes are torn—draws admiring glances.",
stats: { agility: 1, willpower: 1, armor: 1, charisma: 3 },
price: 250,
sellprice: 60,
class: "accessory",
lewd: true
}>>
<<set $phoenixtearnecklace to {
name: "Phoenix Tear Necklace",
description: "A single glowing tear said to contain phoenix essence. Greatly strengthens resolve.",
stats: { willpower: 4 },
price: 400,
sellprice: 100,
class: "accessory"
}>>
<<set $silkstockings to {
name: "Silk Stockings",
description: "Sheer black silk that clings to the legs.",
stats: { agility: 2, charisma: 4 },
price: 300,
sellprice: 75,
class: "accessory",
lewd: true
}>>
/* ==================== WEAPONS ==================== */
<<set $ironspiritsword to {
name: "Iron Spirit Sword",
description: "A reliable sword forged from spirit iron. Balanced and easy to wield.",
stats: { atk: 6 },
price: 200,
sellprice: 50,
class: "weapon"
}>>
<<set $crimsonlotussword to {
name: "Crimson Lotus Sword",
description: "Elegant blade with a crimson edge. Leaves trails of fiery lotus petals when swung.",
stats: { atk: 10, crit: 3 },
price: 450,
sellprice: 110,
class: "weapon"
}>>
<<set $jadewhip to {
name: "Jade Serpent Whip",
description: "Flexible whip carved from spirit jade. Perfect for binding foes—or playful teasing.",
stats: { atk: 8, agility: 4 },
price: 380,
sellprice: 95,
class: "weapon",
lewd: true
}>>
/* ==================== WEAPONS ==================== */
<<set $ironspiritsword to {"name": "Iron Spirit Sword","strength": 0, "agility": 0, "willpower": 0, "armor": 0, "price": 200, "sellprice": 50, "class": "weapon", "ability": 0, "description": "A reliable sword forged from spirit iron. Balanced and easy to wield.", "stats": {"atk": 15}}>>
<<set $crimsonlotussword to {"name": "Crimson Lotus Sword","strength": 0, "agility": 0, "willpower": 0, "armor": 0, "price": 450, "sellprice": 110, "class": "weapon", "ability": 0, "description": "Elegant blade with a crimson edge. Leaves trails of fiery lotus petals when swung.", "stats": {"atk": 25, "crit": 8}}>>
<<set $jadewhip to {"name": "Jade Serpent Whip","strength": 0, "agility": 0, "willpower": 0, "armor": 0, "price": 380, "sellprice": 95, "class": "weapon", "ability": 0, "description": "Flexible whip carved from spirit jade. Perfect for binding foes—or playful teasing.", "stats": {"atk": 20, "agility": 10}}>>
<<set $phoenixfan to {"name": "Phoenix Feather Fan","strength": 0, "agility": 0, "willpower": 0, "armor": 0, "price": 520, "sellprice": 130, "class": "weapon", "ability": 0, "description": "A beautiful folding fan made of phoenix feathers. Strikes release waves of scorching qi.", "stats": {"atk": 22, "crit": 12}}>>
/* EQUIPMENT SYSTEM */
<<set $equippedRobe to null>>
<<set $equippedUnderwear to null>>
<<set $equippedWeapon to null>>
<<set $equippedAccessories to [null, null, null]>>
<<set $robeInventory to []>>
<<set $underwearInventory to []>>
<<set $accessoryInventory to []>>
<<set $weaponInventory to []>>
/* ADD STARTER ITEMS */
<<set $robeInventory.push($cloudsilkgown, $nakedState)>>
<<set $underwearInventory.push($silkunderrobe, $noUnderwear)>>
<<set $accessoryInventory.push($jadehairpin, $silkstockings)>>
<<set $weaponInventory.push($ironspiritsword)>>
<<set $equippedRobe to $cloudsilkgown>>
<<set $equippedUnderwear to $silkunderrobe>>
<<set $equippedAccessories[0] to $jadehairpin>>
<<set $equippedAccessories[1] to $silkstockings>>
<<set $equippedWeapon to $ironspiritsword>><<nobr>>
<div style="position: relative; width: 70%; height: auto;">
<<BackgroundHandler>>
<img src="images/Story/meditation.png" style="width: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
</div>
<</nobr>>
You close your eyes and begin circulating your internal energy.
Qi flows through your meridians, washing over blockages and strengthening your foundation.
Minutes pass. Then hours.
As the spiritual energy around you fades, you open your eyes — your cultivation has progressed.
This opportunity is now gone, and the land feels... ordinary again.
<<set _gain to random(50, 250)>>
<<set $exp += _gain>>
You gain <<print _gain>> experience points!
<<return "Return!">><<link "Go back" $passage>><</link>>
<<nobr>>
<div class="skills-container">
<div class="skills-header">
<h2>Your Divine Techniques</h2>
<p>Secret arts and martial profundities forged on your path to ascension.</p>
</div>
<!-- Equipped Skills Slots -->
<div class="equipped-slots">
<div class="equipped-slot">
<div class="slot-title">Special Technique</div>
<div class="slot-content">
<<if $activeSpecialSkill neq "">>
<<print $activeSpecialSkill>>
<<link "Unequip" "Skills">><<set $activeSpecialSkill to "">><</link>>
<<else>>
<span style="color:#819ca9; font-style:italic;">None equipped</span>
<</if>>
</div>
</div>
<div class="equipped-slot">
<div class="slot-title">Passive Art</div>
<div class="slot-content">
<<if $activePassiveSkill neq "">>
<<print $activePassiveSkill>>
<<link "Unequip" "Skills">><<set $activePassiveSkill to "">><</link>>
<<else>>
<span style="color:#819ca9; font-style:italic;">None equipped</span>
<</if>>
</div>
</div>
<div class="equipped-slot">
<div class="slot-title">Martial Skill</div>
<div class="slot-content">
<<if $activeAttackSkill neq "">>
<<print $activeAttackSkill>>
<<link "Unequip" "Skills">><<set $activeAttackSkill to "">><</link>>
<<else>>
<span style="color:#819ca9; font-style:italic;">None equipped</span>
<</if>>
</div>
</div>
<div class="equipped-slot">
<div class="slot-title">Dao imprint</div>
<div class="slot-content">
<<if $activeDaoImprint neq "">>
<<print $activeDaoImprint>>
<<else>>
<span style="color:#819ca9; font-style:italic;">You don't have any dao imprint!</span>
<</if>>
</div>
</div>
</div>
<!-- Category Tabs -->
<<if !$skillFilter>><<set $skillFilter to "passive">><</if>>
<div class="skill-tabs">
<<link "Passive Arts" "Skills">><<set $skillFilter to "passive">><<replace ".skill-tabs">><</replace>><<replace ".skills-table">><</replace>><</link>>
<<link "Special Techniques" "Skills">><<set $skillFilter to "special">><<replace ".skill-tabs">><</replace>><<replace ".skills-table">><</replace>><</link>>
<<link "Martial Skills" "Skills">><<set $skillFilter to "attack">><<replace ".skill-tabs">><</replace>><<replace ".skills-table">><</replace>><</link>>
</div>
<!-- Skills Table -->
<table class="skills-table">
<thead>
<tr>
<th>Technique</th>
<th>Description</th>
<th style="width:120px; text-align:center;">Level</th>
</tr>
</thead>
<tbody>
<<for _i = 0; _i < $skillInventory.length; _i++>>
<<set _skill = $skillInventory[_i]>>
<<if _skill.category is $skillFilter>>
<<capture _skill>>
<tr class="skill-row">
<td>
<div class="skill-name"><<print _skill.name>></div>
<<if (_skill.category is "special" and $activeSpecialSkill is _skill.name) or
(_skill.category is "passive" and $activePassiveSkill is _skill.name) or
(_skill.category is "attack" and $activeAttackSkill is _skill.name)>>
<span class="equipped-badge">Currently Equipped</span>
<<else>>
<<link "Equip" "Skills">>
<<if _skill.category is "special">>
<<set _skill.isEquipped to "true">>
<<set $activeSpecialSkill to _skill.name>>
<<elseif _skill.category is "passive">>
<<set _skill.isEquipped to "true">>
<<set $activePassiveSkill to _skill.name>>
<<set $activePassiveWidget to _skill.widgetname>>
<<set $activePassiveLevel to _skill.level>>
<<elseif _skill.category is "attack">>
<<set _skill.isEquipped to "true">>
<<set $activeAttackSkill to _skill.name>>
<</if>>
<<replace ".equipped-slots">><</replace>>
<<replace ".skills-table">><</replace>>
<</link>>
<</if>>
</td>
<td><<print _skill.description>></td>
<td class="skill-level"><<print _skill.level>></td>
</tr>
<</capture>>
<</if>>
<</for>>
</tbody>
</table>
<<if $skillInventory.filter(s => s.category is $skillFilter).length eq 0>>
<p style="text-align:center; color:#819ca9; font-style:italic; margin:40px 0;">
No techniques of this category have been learned yet.
</p>
<</if>>
</div>
<</nobr>>
<div class="tab-nav">
<<link "Status">><<goto "Status">><</link>><<link "Skills">><<goto "Skills">><</link>><<link "Inventory">><<goto "Inventory">><</link>><<link "Relations">><<goto "Relations">><</link>><<link "Breakthrough">><<goto "Breakthrough">><</link>><<link "Help">><<goto "Help">><</link>>
</div><<set $activeSpecialSkill to "">>
<<set $activePassiveSkill to "">>
<<set $activeAttackSkill to "">>
<<set $skillFilter = "passive">>
<<set $skillInventory to []>>
<!-- Special Skill -->
<<set $soulflareReversal to {
"name": "Soulflare Reversal",
"skillid": "soulflareReversal",
"widgetname": "SoulflareReversal",
"isEquipped": "false",
"energy": 90,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -10,
"category": "special",
"description": "Burn your own soul essence to reverse a fatal blow, instantly healing a portion of your health and negating death once per battle.",
"leveldescription": "Cooldown is reduced. At higher levels, also reflects part of the damage back to the attacker."
}>>
<<set $skyPiercer to {
"name": "Sky Piercer",
"skillid": "skyPiercer",
"widgetname": "skyPiercer",
"energy": 90,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -10,
"category": "special",
"description": "Pierce the heavens with a blade of Qi, dealing damage to all enemies and ignoring their barriers.",
"leveldescription": "Increases range and critical hit chance by 15%."
}>>
<<set $dragonSoulBurst to {
"name": "Dragon Soul Burst",
"skillid": "dragonSoulBurst",
"widgetname": "dragonSoulBurst",
"energy": 95,
"exp": 420,
"level": 1,
"levelexp": 520,
"levelenergy": -12,
"category": "special",
"description": "Unleash the essence of a dragon's soul, enhancing all attributes for 3 turns.",
"leveldescription": "Duration increases to 4 turns and buffs gain an additional 10% effect."
}>>
<!-- Passive Skill -->
<<set $stoneheartConstitution to {
"name": "Stoneheart Constitution",
"skillid": "stoneheartConstitution",
"widgetname": "StoneheartConstitution",
"isEquipped": "false",
"energy": 0,
"exp": 250,
"level": 1,
"levelexp": 350,
"levelenergy": 0,
"category": "passive",
"description": "Your body is tempered like jade and stone. Increases base defense and resistance to physical damage.",
"leveldescription": "Boosts passive defense further. At high levels, grants minor immunity to bleed and fracture effects."
}>>
<<set $flowingQi to {
"name": "Flowing Qi",
"skillid": "flowingQi",
"widgetname": "flowingQi",
"energy": 0,
"exp": 250,
"level": 1,
"levelexp": 350,
"levelenergy": 0,
"category": "passive",
"description": "Your Qi flows naturally — regenerate 5 energy each turn.",
"leveldescription": "Regeneration increases to 8 energy per turn."
}>>
<<set $ironMeridians to {
"name": "Iron Meridians",
"skillid": "ironMeridians",
"widgetname": "ironMeridians",
"energy": 0,
"exp": 300,
"level": 1,
"levelexp": 400,
"levelenergy": 0,
"category": "passive",
"description": "Your meridians harden like steel — reduce all incoming damage by 10%.",
"leveldescription": "Damage reduction increases to 15%."
}>>
<!-- Attack Skill -->
<<set $heavenSplittingPalm to {
"name": "Heaven-Splitting Palm",
"skillid": "heavenSplittingPalm",
"widgetname": "HeavenSplittingPalm",
"isEquipped": "false",
"energy": 60,
"exp": 300,
"level": 1,
"levelexp": 400,
"levelenergy": -5,
"category": "attack",
"description": "A devastating palm strike that channels spiritual force into raw destructive power. Ignores part of the enemy's defense.",
"leveldescription": "Damage increases with each level. High levels may cause 'stagger' or break enemy defense stance."
}>>
<<set $crimsonSlash to {
"name": "Crimson Slash",
"skillid": "crimsonSlash",
"widgetname": "crimsonSlash",
"energy": 60,
"exp": 300,
"level": 1,
"levelexp": 400,
"levelenergy": -5,
"category": "attack",
"description": "A swift, deadly slash infused with spiritual fire — deals extra fire damage.",
"leveldescription": "Increases fire damage by 20% and adds a chance to burn the enemy."
}>>
<<set $phantomPalm to {
"name": "Phantom Palm",
"skillid": "phantomPalm",
"widgetname": "phantomPalm",
"energy": 50,
"exp": 270,
"level": 1,
"levelexp": 380,
"levelenergy": -4,
"category": "attack",
"description": "Strike with a wave of spiritual energy, dealing damage and potentially knocking the enemy back.",
"leveldescription": "Increases knockback chance and adds minor mental damage."
}>>
<!-- Dao Imprint -->
<<set $devouringessence to {
"name": "Devouring Essence",
"skillid": "devouringessence",
"widgetname": "DevouringEssence",
"isEquipped": "true",
"energy": 0,
"exp": 0,
"level": 1,
"levelexp": 300,
"levelenergy": 0,
"category": "dao",
"statStealChance": 5, /* 5% chance to steal a base stat at Level 1 */
"description": "The mark of one who feeds upon the Dao itself. Your spirit asserts dominion over weaker foundations, forcibly claiming Qi, vitality, and latent potential. Where others cultivate, you harvest.",
"leveldescription": "Actively drains 5% of a target’s Qi and Health, permanently increasing your Max Qi and Max Health. At Level 1, there is a 5% chance to permanently seize 1 point of a random Base Stat from the victim. Higher levels increase drain efficiency and the chance to claim deeper aspects of their foundation."
}>>
<<set $harmonizedessence to {
"name": "Harmonized Essence",
"skillid": "harmonizedessence",
"widgetname": "HarmonizedEssence",
"isEquipped": "true",
"energy": 0,
"exp": 0,
"level": 1,
"levelexp": 300,
"levelenergy": 0,
"category": "dao",
"statGainChance": 3, /* Lower chance than evil, but 'clean' and safe */
"description": "The mark of one aligned with the greater cycle. Your spirit resonates with Heaven’s rhythm, refining excess and discordant energies into stable growth. Nothing is stolen; all is returned in balance.",
"leveldescription": "Passively refines 5% of ambient and encounter-generated energy into permanent increases to Max Qi and Max Health, without harming others. At Level 1, there is a 3% chance to gain 1 point of a random Base Stat through sudden Dao insight. Higher levels improve refinement efficiency and the frequency of enlightenment."
}>>
<!--__________________________________________________________________________________________
__________________________________________________________________________________________!-->
<set $abc1 to {
"name": "abc1",
"skillid": "abc1",
"widgetname": "abc1",
"energy": 90,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -10,
"category": "special",
"description": "abc1",
"leveldescription": "abc1"
}>>
<-- Passive Skill -->
<<set $abc2 to {
"name": "abc2",
"skillid": "abc2",
"widgetname": "abc2",
"energy": 0,
"exp": 250,
"level": 1,
"levelexp": 350,
"levelenergy": 0,
"category": "passive",
"description": "abc2",
"leveldescription": "abc2"
}>>
<-- Attack Skill -->
<<set $abc3 to {
"name": "abc3",
"skillid": "abc3",
"widgetname": "abc3",
"energy": 60,
"exp": 300,
"level": 1,
"levelexp": 400,
"levelenergy": -5,
"category": "attack",
"description": "abc3",
"leveldescription": "abc3"
}>>
__________________________________________________________________________________________
<<set $sectRanks = ["Initiate", "Disciple", "Inner Disciple", "Core Disciple", "True Disciple", "Elder", "Great Elder", "Sect Leader"]>>
<<set $sectManuals to []>>
<<set $sectManuals to {
"righteous": {
"Initiate": [
{
"name": "Falling Star Palm",
"skillid": "fallingStarPalm",
"widgetname": "FallingStarPalm",
"isEquipped": "false",
"energy": 30,
"exp": 0,
"level": 1,
"levelexp": 300,
"levelenergy": -5,
"category": "attack",
"description": "A palm strike that descends like a falling star, striking with explosive force.",
"leveldescription": "Deals splash damage to nearby enemies.",
"ContributionPointCost": 60
},
{
"name": "Radiant Lotus Technique",
"skillid": "radiantLotus",
"widgetname": "RadiantLotus",
"isEquipped": "false",
"energy": 0,
"exp": 0,
"level": 1,
"levelexp": 400,
"levelenergy": 0,
"category": "passive",
"description": "Your presence exudes righteous qi, increasing healing effects and inner clarity.",
"leveldescription": "Further enhances healing and energy regeneration.",
"ContributionPointCost": 50
},
{
"name": "Heavenward Barrier",
"skillid": "heavenwardBarrier",
"widgetname": "HeavenwardBarrier",
"isEquipped": "false",
"energy": 90,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -10,
"category": "special",
"description": "Conjure a celestial shield that blocks a single fatal blow and restores health.",
"leveldescription": "Shorter cooldown and partial damage reflection at higher levels.",
"ContributionPointCost": 75
}
],
"Disciple": [
{
"name": "Soulflare Reversal",
"skillid": "soulflareReversal",
"widgetname": "SoulflareReversal",
"isEquipped": "false",
"energy": 90,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -10,
"category": "special",
"description": "Burn your own soul essence to reverse a fatal blow, instantly healing a portion of your health and negating death once per battle.",
"leveldescription": "Cooldown is reduced. At higher levels, also reflects part of the damage back to the attacker."
}
],
"elder": []
},
"demonic": {
"Initiate": [
{
"name": "Venom Fang Slash",
"skillid": "venomFangSlash",
"widgetname": "VenomFangSlash",
"isEquipped": "false",
"energy": 35,
"exp": 0,
"level": 1,
"levelexp": 300,
"levelenergy": -5,
"category": "attack",
"description": "A vicious claw strike infused with poison, dealing extra damage over time.",
"leveldescription": "Increased poison duration and critical hit chance.",
"ContributionPointCost": 60
},
{
"name": "Unholy Endurance",
"skillid": "unholyEndurance",
"widgetname": "UnholyEndurance",
"isEquipped": "false",
"energy": 0,
"exp": 0,
"level": 1,
"levelexp": 400,
"levelenergy": 0,
"category": "passive",
"description": "Dark cultivation techniques harden your body, granting resistance to pain and weakening.",
"leveldescription": "Further boosts defense and resistance to negative effects.",
"ContributionPointCost": 50
},
{
"name": "Blood Curse Mark",
"skillid": "bloodCurseMark",
"widgetname": "BloodCurseMark",
"isEquipped": "false",
"energy": 100,
"exp": 400,
"level": 1,
"levelexp": 500,
"levelenergy": -15,
"category": "special",
"description": "Sacrifice your own blood to curse an enemy. Reduces their healing and increases damage taken.",
"leveldescription": "Longer curse duration and chance to spread to nearby foes.",
"ContributionPointCost": 75
}
],
"Dsciple": [],
"Elder": []
}
}>>--------------------------------------GENERAL---------------------------------------------
<!-- interaction calcul -->
<<set $power = {
"Mortal": { "": 0 },
"Body Tempering Realm": { "Early": 10, "Middle": 11, "Late": 12 },
"Meridian Awakening Realm": { "Early": 20, "Middle": 21, "Late": 22 },
"Qi Condensation Realm": { "Early": 30, "Middle": 31, "Late": 32 },
"Foundation Establishment Realm": { "Early": 40, "Middle": 41, "Late": 42 },
"Core Formation Realm": { "Early": 50, "Middle": 51, "Late": 52 },
"Nascent Soul Realm": { "Early": 60, "Middle": 61, "Late": 62 }
}>>
<!-- General stats -->
<<set $lifespan to 18>>
<<set $basemaxlifespan to 80>>
<<set $health to 300>>
<<set $basemaxhealth to 300>>
<<set $energy to 200>>
<<set $basemaxenergy to 200>>
<<set $baseluck to 5>>
<<set $baseinsight to 5>>
<<set $passiveatk to 0>>
<<set $passivedef to 0>>
<<set $passivecrit to 0>>
<<set $passivecritres to 0>>
<<set $passiveagility to 0>>
<<set $baseatk to 50>>
<<set $basedef to 5>>
<<set $basecrit to 3>>
<<set $basecritres to 1>>
<<set $baseagility to 7>>
<<set $basemartialArts to 10>>
<<set $basespiritualRoot to 10>>
<<set $basewillpower to 5>>
<<set $basestrength to 5>>
<<set $basecharisma to 5>>
<<set $energyRecovery = $basewillpower/100>>
<<set $healthRecovery = $basestrength/100>>
<<set $destinyatk = 0>>
<<set $destinydef = 0>>
<<set $destinycrit = 0>>
<<set $destinycritres = 0>>
<<set $destinyagility = 0>>
<<set $destinymartialArts = 0>>
<<set $destinyspiritualRoot = 0>>
<<set $destinylifespan to 0>>
<<set $destinyenergy to 0>>
<<set $destinyhealth to 0>>
<<set $atk = $baseatk + $destinyatk + ($basestrength*0.5) + $passiveatk>>
<<set $def = $basedef + $destinydef + $passivedef>>
<<set $crit = $basecrit + $destinycrit + $passivecrit>>
<<set $critres = $basecritres + $destinycritres + $passivecritres>>
<<set $agility = $baseagility + $destinyagility + $passiveagility>>
<<set $martialArts = $basemartialArts + $destinymartialArts>>
<<set $spiritualRoot = $basespiritualRoot + $destinyspiritualRoot>>
<<set $luck to $baseluck>>
<<set $insight to $baseinsight>>
<<set $evadescore = ($agility * 2) + ($insight * 1.5) + ($luck * 0.5)>>
<<set $maxlifespan to $basemaxlifespan + $destinylifespan>>
<<set $maxhealth to $basemaxhealth + $destinyenergy>>
<<set $maxenergy to $basemaxenergy + $destinyhealth>>
reputation -> WIDGET
<<set $charisma to $basecharisma>>
<<set $cultivationRealm to "Body Tempering Realm">>
<<set $cultivationStage to "Early">>
<<set $playerPower = $power[$cultivationRealm][$cultivationStage]>>
<<set $exp to 0>>
<<set $verystart to 0>>
<<set $gold to 0>>
<<set $lastRecoveryTurn = 0>>
<!--------------------------------------NSFW------------------------------------------------>
<<set $corruption to 0>> ->corruption
<<set $virginity to 1>> *if 1 then pc is virgin, else not*
<<set $virginityLost to "">>*with who pc lost virginity*
<<set $analVirginity to 1>>*if 1 then pc is virgin, else not*
<<set $analVirginityLost to "">> *with who pc lost virginity*
<<set $achievements = []>> <!-- Stores unlocked achievements -->
<<set $arousal = 0>>
<<set $maxArousal = 100>>
<!--------------------------------------MAP------------------------------------------------>
<<set $currentRegion to "Region1">>
<<set $sidemission to "inactive">>
<<set $sidemissionX to 0>>
<<set $sidemissionY to 0>>
<<set $turns = 0>>
<<set $turnsPerYear = 24>>
<!---------------------------------------------REPUTATION---------------------------------->
<<set $righteousreputation to 0>>
<<set $demonicreputation to 0>>
<<set $PCrighteousreputation to 0>>
<<set $PCdemonicreputation to 0>>
<<set $totalPCrighteousreputation to $PCrighteousreputation + $righteousreputation>>
<<set $totalPCdemonicreputation to $PCdemonicreputation + $demonicreputation>>
<<set $publicReputation to 0>>
<<set $hiddenReputation to 0>>
<<set $sectSuspicion to 0>>
<<set $fame to 0>>
<<set $sexFame to 0>>
<<set $combatFame to 0>>
<<set $cultivationFame to 0>>
<<set $sectFame to 0>>
<<set $totalFame to ($fame + $sectFame + $cultivationFame + $combatFame)>>
<!--------------------------------------MAIN PLOT------------------------------------------------>
<<set $mainStage0choice to "">>
<<set $activeDaoImprint to "">>
<!--------------------------------------MISCELLANEOUS------------------------------------------------>
<<set $playerfullname to "$playername" + " " + "$playersurname">>
<<set $civilians_harmed to 0>>
<<set $hypocrisyScore to 0>>
<<set $sectLawPressure to 0>>
<<set $sectInvestigationLevel to 0>>
<<set $dualCultivationCount to 0>>
<<set $drainingActs to 0>>
<<set $consensualDualCultivation to 0>>
<<set $forcedExtraction to 0>>
<!--------------------------------------Sect Information------------------------------------------------>
<<set $CurrentPcSectRank to "">>
<<set $CurrentPcSectReputation to 0>>
<<set $CurrentPcSect to "">>
<<set $CurrentPcAffiliation to "">>
<<set $CurrentPcMainSect to "">>
<<set $ContributionPoints to 0>>
<<set $sectFavor to 0>>
<<set $CurrentPcSectRank = ["Initiate", "Disciple", "Inner Disciple", "Core Disciple", "True Disciple", "Elder", "Great Elder", "Sect Leader"]>>
<!--------------------------------------METERS------------------------------------------------>
<<newmeter 'health' 1>>
<<sizing '220px' '25px'>>
<<label "HP: $health / $maxhealth" 'black' center>>
<<colors '#2ecc71' '#e74c3c'>> /* Green to Red */
<</newmeter>>
<<newmeter 'energy' 1>>
<<sizing '220px' '25px'>>
<<label "Qi: $energy / $maxenergy" 'black' center>>
<<colors '#0377fc' '#9b59b6'>> /* Blue to Purple */
<</newmeter>>
<<newmeter 'timer' 0>>
<<colors 'red' 'green'>>
<<animation 10s linear>>
<</newmeter>><<link "Go back" $passage>><</link>>
<<StatsUpdater>>
<<nobr>>
<div class="status-container">
<div class="status-header">
<<UpdatePortrait>>
<div class="status-info">
<div><b>Surname:</b> $playersurname <b>Lifespan:</b> $lifespan / $maxlifespan</div>
<div><b>Name:</b> $playername <b>Sex:</b> Female</div>
<div><b>Charisma:</b> $charisma</div>
<div><b>Realm:</b> <span class="status-realm"><<cultivationStatus>></span></div>
<div><b>Internal Trait:</b> $internalTrait</div>
<div><b>External Trait:</b> <<print $externalTrait>></div>
<div><b>Sect Position:</b> <<print $CurrentPcSectRank>></div>
<div><b>Sect:</b> <<print $CurrentPcAffiliation>></div>
</div>
</div>
Your constitution: <span class="status-constitution"><<print $constitutionName>></span>
<div class="status-stats">
<!-- General Stats -->
<div class="stat-category">
<div class="category-title">General Cultivation</div>
<div class="stat-line"><span class="stat-label">🧬 Lifespan</span><span class="stat-value">$lifespan / $maxlifespan</span></div>
<div class="stat-line"><span class="stat-label">❤️ Health</span><span class="stat-value">$health / $maxhealth</span></div>
<div class="stat-line"><span class="stat-label">⚡ Energy (Qi)</span><span class="stat-value">$energy / $maxenergy</span></div>
<div class="stat-line"><span class="stat-label">🍀 Luck</span><span class="stat-value">$luck</span></div>
<div class="stat-line"><span class="stat-label">🧠 Insight</span><span class="stat-value">$insight</span></div>
<div class="stat-line"><span class="stat-label">💪 Strength</span><span class="stat-value">$basestrength</span></div>
<div class="stat-line"><span class="stat-label">🌀 Willpower</span><span class="stat-value">$basewillpower</span></div>
<div class="stat-line"><span class="stat-label">🧘♂️ Energy Recovery</span><span class="stat-value"><<print $energyRecovery * 100>>%</span></div>
</div>
<!-- Combat Stats -->
<div class="stat-category">
<div class="category-title">Combat Prowess</div>
<div class="stat-line"><span class="stat-label">🗡️ Attack</span><span class="stat-value high">$atk</span></div>
<div class="stat-line"><span class="stat-label">🛡️ Defense</span><span class="stat-value">$def</span></div>
<div class="stat-line"><span class="stat-label">💥 Critical Rate</span><span class="stat-value">$crit%</span></div>
<div class="stat-line"><span class="stat-label">🛑 Critical Resist</span><span class="stat-value">$critres%</span></div>
<div class="stat-line"><span class="stat-label">👟 Agility</span><span class="stat-value">$agility</span></div>
<div class="stat-line"><span class="stat-label">🥋 Martial Arts</span><span class="stat-value high">$martialArts</span></div>
<div class="stat-line"><span class="stat-label">🌌 Spiritual Root</span><span class="stat-value high">$spiritualRoot</span></div>
<div class="stat-line"><span class="stat-label">🩸 Health Recovery</span><span class="stat-value"><<print $healthRecovery * 100>>%</span></div>
</div>
</div>
</div>
<</nobr>>
<<link "H-status" "H-status">><</link>>
<div class="tab-nav">
<<link "Status">><<goto "Status">><</link>><<link "Skills">><<goto "Skills">><</link>><<link "Inventory">><<goto "Inventory">><</link>><<link "Relations">><<goto "Relations">><</link>><<link "Breakthrough">><<goto "Breakthrough">><</link>><<link "Help">><<goto "Help">><</link>>
</div><<RichQiPlace_Region1>> -> cultivation passage
<<RareHerbs_Region1>> -> rare herbs gathering<<widget "CreateNPC_Region1">>\
<<silently>>\
<<set _id = random(0, 10000) + Date.now()>>
<<set _gender = 0>>
<<set _RighteousTendencies = random(100,200)>>
<<set _DemonicTendencies = random(100,200)>>
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _name = $male_npc_names.random()>>
<<set _surname = $npc_surnames.random()>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = ["enemy1", "enemy2", "enemy3", "enemy4"].random()>>
<<set _fullname = _surname + " " + _name>>
<<set _imgID = random(0,10)>>,
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _stageType = ["Early", "Middle", "Late"].random()>>
<<set _realm = ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm"].random()>>
<<set _cultivation = _realm + " " +_stageType>>
<<set _sectAffiliation = ["Clear Sky Azure Dragon Pavilion", "Ghost King Netherworld Sect"].random()>>
<<if _sectAffiliation eq "Clear Sky Azure Dragon Pavilion">><<set _enemySect to "righteous">><<else>><<set _enemySect to "demonic">><</if>>
<<set _npcmentorship = 0>>
<<set _npcRelationship = 0>>
<<if _realm eq "Body Tempering Realm">>
<<if _stageType eq "Early">>
<<set _maxlifespanNPC = random(70, 80)>>
<<set _lifespanNPC = random(18,70)>>
<<set _maxhealthNPC = random(250, 320)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(180, 220)>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(4, 6)>>
<<set _insightNPC = random(4, 6)>>
<<set _basestrengthNPC = random(4, 6)>>
<<set _basewillpowerNPC = random(4, 6)>>
<<set _atkNPC = random(35, 45)>>
<<set _defNPC = random(4, 6)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(1, 2)>>
<<set _agilityNPC = random(6, 8)>>
<<set _martialArtsNPC = random(8, 12)>>
<<set _spiritualRootNPC = random(9, 11)>>
<<elseif _stageType eq "Middle">>
<<set _maxlifespanNPC = random(85, 115)>>
<<set _lifespanNPC = random(18,85)>>
<<set _maxhealthNPC = random(350, 450)>>
<<set _maxenergyNPC = random(250, 320)>>
<<set _luckNPC = random(6, 10)>>
<<set _insightNPC = random(6, 10)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(6, 9)>>
<<set _atkNPC = random(45, 85)>>
<<set _defNPC = random(6, 10)>>
<<set _critNPC = random(4, 7)>>
<<set _critresNPC = random(3, 5)>>
<<set _agilityNPC = random(8, 12)>>
<<set _martialArtsNPC = random(12, 18)>>
<<set _spiritualRootNPC = random(11, 14)>>
<<elseif _stageType eq "Late">>
<<set _maxlifespanNPC = random(115, 130)>>
<<set _lifespanNPC = random(18,115)>>
<<set _maxhealthNPC = random(500, 700)>>
<<set _maxenergyNPC = random(350, 500)>>
<<set _luckNPC = random(8, 14)>>
<<set _insightNPC = random(10, 16)>>
<<set _basestrengthNPC = random(11, 15)>>
<<set _basewillpowerNPC = random(10, 14)>>
<<set _atkNPC = random(85, 120)>>
<<set _defNPC = random(12, 18)>>
<<set _critNPC = random(6, 10)>>
<<set _critresNPC = random(6, 10)>>
<<set _agilityNPC = random(12, 18)>>
<<set _martialArtsNPC = random(16, 25)>>
<<set _spiritualRootNPC = random(15, 20)>>
<</if>>
<</if>>
<<if _realm eq "Meridian Awakening Realm">>
<<if _stageType eq "Early">>
<<set _maxlifespanNPC = random(135, 140)>>
<<set _lifespanNPC = random(18,135)>>
<<set _maxhealthNPC = random(750, 900)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(600, 720)>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(10, 14)>>
<<set _insightNPC = random(12, 16)>>
<<set _basestrengthNPC = random(16, 20)>>
<<set _basewillpowerNPC = random(14, 18)>>
<<set _atkNPC = random(120, 170)>>
<<set _defNPC = random(20, 30)>>
<<set _critNPC = random(8, 12)>>
<<set _critresNPC = random(8, 12)>>
<<set _agilityNPC = random(16, 22)>>
<<set _martialArtsNPC = random(24, 32)>>
<<set _spiritualRootNPC = random(22, 30)>>
<<elseif _stageType eq "Middle">>
<<set _maxlifespanNPC = random(145, 150)>>
<<set _lifespanNPC = random(18,145)>>
<<set _maxhealthNPC = random(1000, 1200)>>
<<set _maxenergyNPC = random(800, 1000)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(14, 20)>>
<<set _insightNPC = random(18, 24)>>
<<set _basestrengthNPC = random(20, 26)>>
<<set _basewillpowerNPC = random(18, 24)>>
<<set _atkNPC = random(170, 220)>>
<<set _defNPC = random(28, 40)>>
<<set _critNPC = random(10, 16)>>
<<set _critresNPC = random(10, 16)>>
<<set _agilityNPC = random(22, 30)>>
<<set _martialArtsNPC = random(30, 40)>>
<<set _spiritualRootNPC = random(28, 36)>>
<<elseif _stageType eq "Late">>
<<set _maxlifespanNPC = random(155, 160)>>
<<set _lifespanNPC = random(18,155)>>
<<set _maxhealthNPC = random(1400, 1800)>>
<<set _maxenergyNPC = random(1200, 1600)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(20, 28)>>
<<set _insightNPC = random(26, 34)>>
<<set _basestrengthNPC = random(28, 36)>>
<<set _basewillpowerNPC = random(26, 32)>>
<<set _atkNPC = random(220, 270)>>
<<set _defNPC = random(40, 55)>>
<<set _critNPC = random(14, 20)>>
<<set _critresNPC = random(14, 20)>>
<<set _agilityNPC = random(30, 40)>>
<<set _martialArtsNPC = random(38, 50)>>
<<set _spiritualRootNPC = random(35, 45)>>
<</if>>
<</if>>
<<if _realm eq "Qi Condensation Realm">>
<<if _stageType eq "Early">>
<<set _maxlifespanNPC = random(165, 170)>>
<<set _lifespanNPC = random(18,165)>>
<<set _maxhealthNPC = random(900, 900)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(600, 720)>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(10, 14)>>
<<set _insightNPC = random(12, 16)>>
<<set _basestrengthNPC = random(16, 20)>>
<<set _basewillpowerNPC = random(14, 18)>>
<<set _atkNPC = random(270, 330)>>
<<set _defNPC = random(20, 30)>>
<<set _critNPC = random(8, 12)>>
<<set _critresNPC = random(8, 12)>>
<<set _agilityNPC = random(16, 22)>>
<<set _martialArtsNPC = random(24, 32)>>
<<set _spiritualRootNPC = random(22, 30)>>
<<elseif _stageType eq "Middle">>
<<set _maxlifespanNPC = random(175, 180)>>
<<set _lifespanNPC = random(18,175)>>
<<set _maxhealthNPC = random(1000, 1200)>>
<<set _maxenergyNPC = random(800, 1000)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(14, 20)>>
<<set _insightNPC = random(18, 24)>>
<<set _basestrengthNPC = random(20, 26)>>
<<set _basewillpowerNPC = random(18, 24)>>
<<set _atkNPC = random(330, 380)>>
<<set _defNPC = random(28, 40)>>
<<set _critNPC = random(10, 16)>>
<<set _critresNPC = random(10, 16)>>
<<set _agilityNPC = random(22, 30)>>
<<set _martialArtsNPC = random(30, 40)>>
<<set _spiritualRootNPC = random(28, 36)>>
<<elseif _stageType eq "Late">>
<<set _maxlifespanNPC = random(185, 200)>>
<<set _lifespanNPC = random(18,185)>>
<<set _maxhealthNPC = random(1400, 1800)>>
<<set _maxenergyNPC = random(1200, 1600)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(20, 28)>>
<<set _insightNPC = random(26, 34)>>
<<set _basestrengthNPC = random(28, 36)>>
<<set _basewillpowerNPC = random(26, 32)>>
<<set _atkNPC = random(370, 430)>>
<<set _defNPC = random(40, 55)>>
<<set _critNPC = random(14, 20)>>
<<set _critresNPC = random(14, 20)>>
<<set _agilityNPC = random(30, 40)>>
<<set _martialArtsNPC = random(38, 50)>>
<<set _spiritualRootNPC = random(35, 45)>>
<</if>>
<</if>>
<<set _intTrait = $NPCinternalOptions.random()>>
<<set _extTrait = $NPCexternalOptions.random()>>
<<set _friendship = 0>>
<<set _had_sex = 0>>
<<set _talk = true>>
<<set _charm = random(1, 5)>>
<<set _depravity = random(7, 30)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _npc = {
id: _id,
IdImg: _imgID,
name: _name,
surname: _surname,
internalTrait: _intTrait,
externalTrait: _extTrait,
friendship: _friendship,
depravity: _depravity,
charm: _charm,
talk: _talk,
hadSex: _had_sex,
mentorshipType: _npcmentorship,
relationshipType: _npcRelationship,
sectNPC: _sectAffiliation,
realm: _cultivation,
gender: _gender,
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
RightTendencies: _RighteousTendencies,
DemonTendencies: _DemonicTendencies,
enemySectType: _enemySect
}>>
<</silently>>\
<</widget>>\
\
\
\
\
<<widget "ArrogantYoungMaster">>
<<silently>>
<<set _id = random(10001, 20000) + Date.now()>>
<<set _name = $male_npc_names.random()>>
<<set _surname = $npc_surnames.random()>>
<<set _fullname = _surname + " " + _name>>
<<set _enemyability = []>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = ["aym", "aym2", "aym3", "aym4", "aym5", "aym6", "aym7","aym8","aym9","aym10"].random()>>
<<set _enemyability.push("attack", "attack")>>
<<set _stageType = ["Early", "Middle", "Late"].random()>>
<<if $cultivationRealm eq "Body Tempering Realm">><<set _realm = "Body Tempering Realm">><<elseif $cultivationRealm eq "Meridian Awakening Realm">>
<<set _realm = "Body Tempering Realm">><<elseif $cultivationRealm eq "Qi Condensation Realm">><<set _realm = "Meridian Awakening Realm">><</if>>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _cultivation = _realm + " " +_stageType>>
<<set _sectAffiliation = $npc_sects.random()>>
<<set _maxlifespanNPC = random(85, 115)>>
<<set _lifespanNPC = random(18,25)>>
<<set _maxhealthNPC = random(350, 450)>>
<<set _maxenergyNPC = random(250, 320)>>
<<set _luckNPC = random(6, 10)>>
<<set _insightNPC = random(6, 10)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(6, 9)>>
<<set _atkNPC = random(15, 22)>>
<<set _defNPC = random(6, 10)>>
<<set _critNPC = random(4, 7)>>
<<set _critresNPC = random(3, 5)>>
<<set _agilityNPC = random(8, 12)>>
<<set _martialArtsNPC = random(12, 18)>>
<<set _spiritualRootNPC = random(11, 14)>>
<<set _friendship = 0>>
<<set _intTrait = $NPCinternalOptions.random()>>
<<set _extTrait = $NPCexternalOptions.random()>>
<<set _npc = {
id: _id,
name: _name,
enemyimage: _enemyimage,
enemyregion: _enemyregion,
surname: _surname,
internalTrait: _intTrait,
externalTrait: _extTrait,
friendship: _friendship,
depravity: _depravity,
charm: _charm,
friendship: _friendship,
talk: _talk,
hadSex: _had_sex,
mentorshipType: _npcmentorship,
relationshipType: _npcRelationship,
sectNPC: _clan,
realm: _cultivation,
gender: _gender,
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
enemyAbility: _enemyability,
NPClocation: _location
}>>
<</silently>>
<</widget>>
<<widget "CreateMentor">>
<<silently>>
<<set _id = random(0, 10000) + Date.now()>>
<<set _gender = ["male","female"].random()>>
<<set _RighteousTendencies = random(100,200)>>
<<set _DemonicTendencies = random(100,200)>>
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<if _gender eq "male">>
<<set _name = $male_npc_names.random()>>
<<set _surname = $npc_surnames.random()>>
<<else>>
<<set _name = $female_npc_names.random()>>
<<set _surname = $npc_surnames.random()>>
<</if>>
<<set _enemyregion = "Enemy">>
<<if _gender eq "male">>
<<set _enemyimage = ["master1", "master2", "master3"].random()>>
<<else>>
<<set _enemyimage = ["mentress1", "mentress2", "mentress3"].random()>>
<</if>>
<<set _fullname = _surname + " " + _name>>
<<set _imgID = random(0,10)>>
<<set _intTrait = $NPCinternalOptions.random()>>
<<set _extTrait = $NPCexternalOptions.random()>>
<<set _sectRank to "Elder">>
<<set _stageType = ["Early", "Middle", "Late"].random()>>
<<set _realm = "Golden Core Realm">>
<<set _cultivation = _realm + " " +_stageType>>
<<set _sectAffiliation = ["Clear Sky Azure Dragon Pavilion", "Ghost King Netherworld Sect"].random()>>
<<if _sectAffiliation eq "Clear Sky Azure Dragon Pavilion">><<set _enemySect to "righteous">><<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain", "Clear Sky Azure Dragon Pavilion"].random()>><<else>><<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain", "Ghost King Netherworld Sect"].random()>><<set _enemySect to "demonic">><</if>>
<<set _npcmentorship = 1>>
<<set _npcRelationship = 0>>
<<set _friendship = 0>>
<<if _stageType eq "Early">>
<<set _maxlifespanNPC = random(300, 350)>>
<<set _lifespanNPC = random(80, 300)>>
<<set _maxhealthNPC = random(2000, 2400)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(1800, 2200)>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(28, 35)>>
<<set _insightNPC = random(30, 40)>>
<<set _basestrengthNPC = random(35, 45)>>
<<set _basewillpowerNPC = random(30, 40)>>
<<set _atkNPC = random(120, 150)>>
<<set _defNPC = random(50, 70)>>
<<set _critNPC = random(18, 24)>>
<<set _critresNPC = random(16, 20)>>
<<set _agilityNPC = random(30, 40)>>
<<set _martialArtsNPC = random(50, 70)>>
<<set _spiritualRootNPC = random(45, 60)>>
<<elseif _stageType eq "Middle">>
<<set _maxlifespanNPC = random(350, 400)>>
<<set _lifespanNPC = random(80, 350)>>
<<set _maxhealthNPC = random(2400, 2800)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(2200, 2600)>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(34, 45)>>
<<set _insightNPC = random(40, 55)>>
<<set _basestrengthNPC = random(45, 60)>>
<<set _basewillpowerNPC = random(40, 55)>>
<<set _atkNPC = random(150, 200)>>
<<set _defNPC = random(70, 100)>>
<<set _critNPC = random(20, 28)>>
<<set _critresNPC = random(18, 26)>>
<<set _agilityNPC = random(40, 60)>>
<<set _martialArtsNPC = random(70, 90)>>
<<set _spiritualRootNPC = random(60, 75)>>
<<elseif _stageType eq "Late">>
<<set _maxlifespanNPC = random(400, 500)>>
<<set _lifespanNPC = random(80, 400)>>
<<set _maxhealthNPC = random(2800, 3500)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(2600, 3200)>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(40, 55)>>
<<set _insightNPC = random(50, 70)>>
<<set _basestrengthNPC = random(60, 80)>>
<<set _basewillpowerNPC = random(55, 75)>>
<<set _atkNPC = random(200, 250)>>
<<set _defNPC = random(100, 130)>>
<<set _critNPC = random(24, 32)>>
<<set _critresNPC = random(20, 30)>>
<<set _agilityNPC = random(60, 80)>>
<<set _martialArtsNPC = random(90, 120)>>
<<set _spiritualRootNPC = random(75, 90)>>
<</if>>
<<set _npc = {
id: _id,
IdImg: _imgID,
name: _name,
surname: _surname,
internalTrait: _intTrait,
externalTrait: _extTrait,
friendship: _friendship,
depravity: _depravity,
charm: _charm,
talk: _talk,
hadSex: _had_sex,
mentorshipType: _npcmentorship,
relationshipType: _npcRelationship,
sectNPC: _sectAffiliation,
realm: _cultivation,
gender: _gender,
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: _lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
RightTendencies: _RighteousTendencies,
DemonTendencies: _DemonicTendencies,
enemySectType: _enemySect,
NPCrank: _sectRank
}>>
<</silently>>
<</widget>>
<<widget "CreateNPC001">>
<<silently>>
<<set _id = random(0, 10000) + Date.now()>>
<<set _gender = _setupGender ?? ["male","female"].random()>>
<<set _RighteousTendencies = random(100,200)>>
<<set _DemonicTendencies = random(100,200)>>
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _minAge = _setupAge ?? 18>>
<<if _gender eq "male">>
<<set _name = $male_npc_names.random()>>
<<set _surname = _setupSurname ?? $npc_surnames.random()>>
<<else>>
<<set _name = $female_npc_names.random()>>
<<set _surname = _setupSurname ?? $npc_surnames.random()>>
<</if>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = ["enemy1", "enemy2", "enemy3", "enemy4"].random()>>
<<set _fullname = _surname + " " + _name>>
<<set _imgID = random(0,10)>>,
<<set _sectAffiliation = ["Clear Sky Azure Dragon Pavilion", "Ghost King Netherworld Sect", "Unafiliated"].random()>>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<if _sectAffiliation eq "Clear Sky Azure Dragon Pavilion">><<set _enemySect to "righteous">><<elseif _sectAffiliation eq "Ghost King Netherworld Sect">><<set _enemySect to "demonic">><<else>><<set _enemySect to ["righteous", "demonic"].random() >><</if>>
<<set _npcmentorship = 0>>
<<set _npcRelationship = 0>>
<<if _sectAffiliation eq "Unafiliated">><<set _sectRank to "">><<else>><<set _sectRank to ["Member", "Disciple", "Elder"].random()>><</if>>
<<set _depravity = random(7, 30)>>
<<set _friendship = 0>>
<<set _charm to 10>>
<<set _talk to 0>>
<<set _had_sex to 0>>
<<set _intTrait = $NPCinternalOptions.random()>>
<<set _extTrait = $NPCexternalOptions.random()>>
<<if _targetRealm and _targetStage>>
<<set _realm to _targetRealm>>
<<set _stageType to _targetStage>>
/* Clear them out after using them so they don't infect non-tournament battles */
<<set _cultivation = _realm + " " +_stageType>>
<<set _power = $power[_realm][_stageType]>>
<<set _stats = $GenerationNPCRealmStats[_realm][_stageType]>>
<<else>>
<<set _realm = ["Body Tempering Realm","Meridian Awakening Realm","Qi Condensation Realm"].random()>>
<<set _stageType = ["Early","Middle","Late"].random()>>
<<set _cultivation = _realm + " " +_stageType>>
<<set _power = $power[_realm][_stageType]>>
<<set _stats = $GenerationNPCRealmStats[_realm][_stageType]>>
<</if>>
<<set _maxlifespanNPC = random(_stats.lifespan[0], _stats.lifespan[1])>>
<<set _lifespanNPC = random(_minAge, _maxlifespanNPC)>>
<<set _maxhealthNPC = random(_stats.health[0], _stats.health[1])>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _maxenergyNPC = random(_stats.energy[0], _stats.energy[1])>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(_stats.luck[0], _stats.luck[1])>>
<<set _insightNPC = random(_stats.insight[0], _stats.insight[1])>>
<<set _basestrengthNPC = random(_stats.basestrength[0], _stats.basestrength[1])>>
<<set _basewillpowerNPC = random(_stats.basewillpower[0], _stats.basewillpower[1])>>
<<set _atkNPC = random(_stats.atk[0], _stats.atk[1])>>
<<set _defNPC = random(_stats.def[0], _stats.def[1])>>
<<set _critNPC = random(_stats.crit[0], _stats.crit[1])>>
<<set _critresNPC = random(_stats.critres[0], _stats.critres[1])>>
<<set _agilityNPC = random(_stats.agility[0], _stats.agility[1])>>
<<set _martialArtsNPC = random(_stats.martialArts[0], _stats.martialArts[1])>>
<<set _spiritualRootNPC = random(_stats.spiritualRoot[0], _stats.spiritualRoot[1])>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _npcArousal = 0>>
<<set _npc = {
npcArousal: _npcArousal,
id: _id,
IdImg: _imgID,
name: _name,
surname: _surname,
internalTrait: _intTrait,
externalTrait: _extTrait,
friendship: _friendship,
depravity: _depravity,
charm: _charm,
talk: _talk,
hadSex: _had_sex,
mentorshipType: _npcmentorship,
relationshipType: _npcRelationship,
sectNPC: _sectAffiliation,
realm: _cultivation,
gender: _gender,
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: _lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
RightTendencies: _RighteousTendencies,
DemonTendencies: _DemonicTendencies,
enemySectType: _enemySect,
NPCrank: _sectRank,
power: _power,
hasGrudge: false,
deathCause: null, /* "old_age", "murder", "revenge_killed", etc.*/
killedByPlayer: false,
killedInRevenge: false, /* true if killed during a revenge encounter*/
deathGrudgeType: null, /* the type of grudge they were avenging*/
deathGrudgeVictim: null, /* the victim they were avenging*/
isDead: (_setupDead ?? false),
relations: {
parents: [],
swornParents: [],
masters: [],
spouses: [],
partners: [],
siblings: [],
swornSiblings: [],
children: [],
apprentices: []
}
}>>
<</silently>>
<</widget>>
<<widget "GenerateLineageBatch">>
<<silently>>
<<set _existingMain to $args[0] || null>>
<<set $encounterBatch to {}>>
<<set _allNPCs to []>> /* Track all generated NPCs for cross-linking */
/* 1. Generate or use the Focus NPC */
<<if _existingMain>>
<<set _main to _existingMain>>
<<set $encounterMainID to _main.id>>
<<set $encounterBatch[_main.id] to _main>>
<<else>>
<<CreateNPC001>>
<<set _main to _npc>>
<<set _main.isMet to true>>
<<set $encounterMainID to _main.id>>
<<set $encounterBatch[_main.id] to _main>>
<</if>>
/* Ensure main NPC has all relation arrays */
<<if not _main.relations>>
<<set _main.relations to {}>>
<</if>>
<<set _relTypes to ["parents", "swornParents", "masters", "spouses", "partners", "siblings", "swornSiblings", "children", "apprentices", "lovers", "ex_lovers", "betrothed"]>>
<<for _type range _relTypes>>
<<if not _main.relations[_type]>>
<<set _main.relations[_type] to []>>
<</if>>
<</for>>
<<set _allNPCs.push(_main)>>
/* 2. PARENTS (Father & Mother) */
<<set _parentPool to [
{ type: "father", chance: 60, gender: "male", sameSurname: true, ageMod: [20, 50] },
{ type: "mother", chance: 50, gender: "female", sameSurname: false, ageMod: [18, 45] }
]>>
<<for _rel range _parentPool>>
<<if random(1, 100) lte _rel.chance>>
<<set _setupSurname to (_rel.sameSurname ? _main.surname : null)>>
<<set _setupAge to _main.NPClifespan + random(_rel.ageMod[0], _rel.ageMod[1])>>
<<set _setupGender to _rel.gender>>
<<set _setupDead to (random(1, 100) lt 20)>>
<<CreateNPC001>>
<<set _rNPC to _npc>>
<<set _rNPC.isMet to false>>
/* Ensure new NPC has relation arrays */
<<if not _rNPC.relations>>
<<set _rNPC.relations to {}>>
<</if>>
<<for _type range _relTypes>>
<<if not _rNPC.relations[_type]>>
<<set _rNPC.relations[_type] to []>>
<</if>>
<</for>>
/* Create two-way parent-child links */
<<run _main.relations.parents.push(_rNPC.id)>>
<<run _rNPC.relations.children.push(_main.id)>>
<<set $encounterBatch[_rNPC.id] = _rNPC>>
<<set _allNPCs.push(_rNPC)>>
<</if>>
<</for>>
/* 3. LOVERS AND ROMANTIC CONNECTIONS */
<<set _romancePool to [
{ type: "lover", chance: 30, category: "lovers", ageMod: [-5, 5] },
{ type: "ex_lover", chance: 15, category: "ex_lovers", ageMod: [-10, 10] },
{ type: "betrothed", chance: 10, category: "betrothed", ageMod: [-5, 5] }
]>>
<<for _rel range _romancePool>>
<<if random(1, 100) lte _rel.chance>>
<<set _setupGender to (_main.gender == "male" ? "female" : "male")>>
<<set _setupSurname to null>> /* Lovers keep their own surnames */
<<set _setupAge to _main.NPClifespan + random(_rel.ageMod[0], _rel.ageMod[1])>>
<<set _setupDead to (random(1, 100) lt 15)>>
<<CreateNPC001>>
<<set _rNPC to _npc>>
<<set _rNPC.isMet to false>>
/* Ensure new NPC has relation arrays */
<<if not _rNPC.relations>>
<<set _rNPC.relations to {}>>
<</if>>
<<for _type range _relTypes>>
<<if not _rNPC.relations[_type]>>
<<set _rNPC.relations[_type] to []>>
<</if>>
<</for>>
/* Create two-way romantic links */
<<if _rel.type eq "lover">>
<<run _main.relations.lovers.push(_rNPC.id)>>
<<run _rNPC.relations.lovers.push(_main.id)>>
<<elseif _rel.type eq "ex_lover">>
<<run _main.relations.ex_lovers.push(_rNPC.id)>>
<<run _rNPC.relations.ex_lovers.push(_main.id)>>
<<elseif _rel.type eq "betrothed">>
<<run _main.relations.betrothed.push(_rNPC.id)>>
<<run _rNPC.relations.betrothed.push(_main.id)>>
<</if>>
<<set $encounterBatch[_rNPC.id] = _rNPC>>
<<set _allNPCs.push(_rNPC)>>
<</if>>
<</for>>
/* 4. SIBLINGS */
<<set _siblingCount to random(0, 3)>>
<<set _siblings to []>>
<<for _i = 0; _i lt _siblingCount; _i++>>
<<if random(1, 100) lt 40>>
<<set _setupSurname to _main.surname>>
<<set _setupAge to _main.NPClifespan + random(-10, 10)>>
<<set _setupDead to (random(1, 100) lt 15)>>
<<set _setupGender to ["male", "female"].random()>>
<<CreateNPC001>>
<<set _rNPC to _npc>>
<<set _rNPC.isMet to false>>
/* Ensure new NPC has relation arrays */
<<if not _rNPC.relations>>
<<set _rNPC.relations to {}>>
<</if>>
<<for _type range _relTypes>>
<<if not _rNPC.relations[_type]>>
<<set _rNPC.relations[_type] to []>>
<</if>>
<</for>>
<<set _siblings.push(_rNPC)>>
<<set $encounterBatch[_rNPC.id] = _rNPC>>
<<set _allNPCs.push(_rNPC)>>
<</if>>
<</for>>
/* Link siblings to each other and to parents */
<<for _sibling range _siblings>>
/* Link to main */
<<if not _main.relations.siblings.includes(_sibling.id)>>
<<run _main.relations.siblings.push(_sibling.id)>>
<</if>>
<<if not _sibling.relations.siblings.includes(_main.id)>>
<<run _sibling.relations.siblings.push(_main.id)>>
<</if>>
/* Link to parents if they exist */
<<for _parentId range _main.relations.parents>>
<<if not _sibling.relations.parents.includes(_parentId)>>
<<run _sibling.relations.parents.push(_parentId)>>
<</if>>
/* Add sibling to parent's children */
<<set _parent = $encounterBatch[_parentId]>>
<<if _parent and not _parent.relations.children.includes(_sibling.id)>>
<<run _parent.relations.children.push(_sibling.id)>>
<</if>>
<</for>>
<</for>>
/* 5. MASTERS */
<<set _masterCount to random(1, 2)>>
<<for _i = 0; _i lt _masterCount; _i++>>
<<if random(1, 100) lt 30>>
<<set _setupAge to _main.NPClifespan + random(30, 100)>>
<<set _setupDead to (random(1, 100) lt 25)>>
<<set _setupGender to ["male", "female"].random()>>
<<set _setupSurname to null>>
<<CreateNPC001>>
<<set _rNPC to _npc>>
<<set _rNPC.isMet to false>>
/* Ensure new NPC has relation arrays */
<<if not _rNPC.relations>>
<<set _rNPC.relations to {}>>
<</if>>
<<for _type range _relTypes>>
<<if not _rNPC.relations[_type]>>
<<set _rNPC.relations[_type] to []>>
<</if>>
<</for>>
<<run _main.relations.masters.push(_rNPC.id)>>
<<run _rNPC.relations.apprentices.push(_main.id)>>
<<set $encounterBatch[_rNPC.id] = _rNPC>>
<<set _allNPCs.push(_rNPC)>>
<</if>>
<</for>>
/* 6. APPRENTICES */
<<if _main.NPClifespan gt 30>>
<<set _apprCount to random(0, 2)>>
<<for _i = 0; _i lt _apprCount; _i++>>
<<if random(1, 100) lt 25>>
<<set _setupAge to random(18, _main.NPClifespan - 10)>>
<<set _setupDead to (random(1, 100) lt 15)>>
<<set _setupGender to ["male", "female"].random()>>
<<set _setupSurname to null>>
<<CreateNPC001>>
<<set _rNPC to _npc>>
<<set _rNPC.isMet to false>>
/* Ensure new NPC has relation arrays */
<<if not _rNPC.relations>>
<<set _rNPC.relations to {}>>
<</if>>
<<for _type range _relTypes>>
<<if not _rNPC.relations[_type]>>
<<set _rNPC.relations[_type] to []>>
<</if>>
<</for>>
<<run _main.relations.apprentices.push(_rNPC.id)>>
<<run _rNPC.relations.masters.push(_main.id)>>
<<set $encounterBatch[_rNPC.id] = _rNPC>>
<<set _allNPCs.push(_rNPC)>>
<</if>>
<</for>>
<</if>>
/* 7. FINAL PASS: Ensure all family connections are complete */
<<for _npc1 range _allNPCs>>
<<for _npc2 range _allNPCs>>
<<if _npc1.id != _npc2.id>>
/* If they share parents, ensure sibling link exists */
<<set _shareParents to false>>
<<for _parentId range _npc1.relations.parents>>
<<if _npc2.relations.parents.includes(_parentId)>>
<<set _shareParents to true>>
<</if>>
<</for>>
<<if _shareParents>>
<<if not _npc1.relations.siblings.includes(_npc2.id)>>
<<run _npc1.relations.siblings.push(_npc2.id)>>
<</if>>
<<if not _npc2.relations.siblings.includes(_npc1.id)>>
<<run _npc2.relations.siblings.push(_npc1.id)>>
<</if>>
<</if>>
/* Ensure child-parent links are bidirectional */
<<if _npc1.relations.parents.includes(_npc2.id) and not _npc2.relations.children.includes(_npc1.id)>>
<<run _npc2.relations.children.push(_npc1.id)>>
<</if>>
<<if _npc2.relations.parents.includes(_npc1.id) and not _npc1.relations.children.includes(_npc2.id)>>
<<run _npc1.relations.children.push(_npc2.id)>>
<</if>>
<</if>>
<</for>>
<</for>>
<</silently>>
<</widget>><<set $male_npc_names = [
"Yun","Jie","Tian","Rui","Sheng","Zhen","Hao","Lei","Qing","Long","Xuan","Bo","Chen","Yue","Jin","Wei","Ren","Fang","Yao","Heng","Zhi","Xing","Han","Fei","Chao"
]>>
<<set $female_npc_names = [
"Mei","Lian","Hua","Xue","Ling","Yue","Lan","Qin","Rin","Yin","Shui","Fen","Zhi","Ai","Na","Yu","Ning","Ting","Xia","Bo","Qiao","Min","Ruo","Li","Jing"
]>>
<<set $npc_surnames = [
"Li","Zhao","Mo","Feng","Shen","Wei","Jiang","Han","Leng","Wu","Zhou","Yan","Bai","Chen","Duan","Qin","Xie","Lin","Zhang","Gu"
]>>
<<set $known_npc_list = []>>
<<set $npc_list = []>>
<<set $npc_fem_list = []>>
<<set $active_npc = []>>
<<set $npc_sects =[
"Heavenly Sword Pavilion", "Dragonblood Imperial Clan", "Violet Flame Sect", "Sun-Crushing Hall", "Everlasting Sky Clan", "Black Jade Phoenix Palace", "Golden Tyrant Sect", "Thousand Thunder Pavilion"
]>>
<<set $enemyBattleQuotes = [
"Your moves are crude. Were you trained by farmers?",
"Hah! Is that all your sect has taught you?",
"You dare face me with such pitiful strength?",
"The heavens themselves tremble at my cultivation!",
"You’ll need more than flashy footwork to defeat me.",
"Even my juniors hit harder than that.",
"Your fate was sealed the moment you stepped into this arena.",
"My qi flows like a raging river. You cannot stop it.",
"You might land a strike, but you’ll never break my will.",
"Come! Let this be a lesson written in bruises.",
"You fight with courage... but lack wisdom.",
"Still standing? Impressive... but futile.",
"This duel is over — you just don’t know it yet.",
"Your spiritual roots are weak. I sense no destiny in you.",
"Let’s see how long that arrogance lasts under pressure.",
"You hold back. Why? Are you afraid of your own strength?",
"I’ve bested beasts with more fight than you.",
"Is this what the righteous path teaches now? Pathetic.",
"You're not bad... but I won’t lose to someone like you.",
"A spark of talent — wasted on someone without control."
]>>
<<set $neutralTalkNPC to [
"You look like a new face around here.",
"Not many travelers pass through this area.",
"What brings you to this place?",
"Be careful. Not all cultivators are as kind as they appear.",
"The spiritual energy feels dense today, doesn't it?"
]>>
<<set $friendlyTalkNPC to [
"It’s always good to see a friendly face.",
"Training hard again? You never take a break.",
"I found a quiet spot by the waterfall—you’d love it.",
"Let me know if you ever need help with your cultivation.",
"The sect's been talking about your progress. You're not bad."
]>>
<<set $loverTalkNPC to [
"I dreamed of you last night…",
"Come closer. I want to feel your presence.",
"You always make my heart feel lighter.",
"After everything, I’m glad we met.",
"When this world turns to chaos, remember you have me."
]>>
<<set $highDepravityTalkNPC to [
"Power is the only language worth speaking.",
"Desire isn't a weakness—it's fuel.",
"Have you ever killed someone and felt… exhilarated?",
"Kindness? That's a lie we tell ourselves.",
"I could show you things you'd never forget… if you're brave enough."
]>>
<<set $MentorTalkNPC to [
"Your stance is improving. Slightly.",
"Discipline, focus, and patience—that’s the path.",
"Did you review the techniques I assigned?",
"Even a spark can become a flame. Don’t waste your potential.",
"I was once like you… hungry for power, blind to the cost."
]>>
<<set $ApprenticeTalkNPC to [
"Master, do you think I’m ready for the next realm?",
"I tried the technique you showed me, but something feels off.",
"Thank you for taking me in. I won’t disappoint you.",
"Sometimes I wonder why you chose me.",
"Your teachings… they saved me more than once."
]>>
<<set $enemyTalkNPC to [
"Still alive? Disappointing.",
"One day, I’ll surpass you. Count on it.",
"Don’t think I’ve forgotten what you did.",
"You may have power, but you lack honor.",
"Every time we speak, I lose more respect for you."
]>>
<<set $highTalk to [
"You’ve changed since we first met.",
"Talking to you always makes things clearer.",
"Strange… I never thought I’d trust someone like you.",
"So much has happened, hasn’t it?",
"Even in silence, your presence comforts me."
]>>
<<set $activeGrudges to []>> // Array to store active grudges
/* Grudge structure:
// {
// id: unique_id,
// avengerId: npc_id,
// victimId: npc_id (the one who was wronged or their relative),
// type: "rape", "seduction", "murder", "theft", "humiliation", "betrayal",
// severity: 1-10,
// targetType: "player", "npc",
// triggered: false,
// location: "any", "city", "wilderness", "sect",
// relationshipToVictim: "lover", "parent", "sibling", "master", "friend"
// } */
<<set $cultivationRealms = ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm", "Foundation Establishment Realm", "Core Formation Realm", "Nascent Soul Realm"]>>
<<set $cultivationStages = ["Early", "Middle", "Late"]>>
<<set $GenerationNPCRealmStats = {
"Body Tempering Realm": {
"Early": {
"lifespan": [70, 80],
"health": [250, 320],
"energy": [180, 220],
"luck": [4, 6],
"insight": [4, 6],
"basestrength": [4, 6],
"basewillpower": [4, 6],
"atk": [35, 45],
"def": [4, 6],
"crit": [2, 4],
"critres": [1, 2],
"agility": [6, 8],
"martialArts": [8, 12],
"spiritualRoot": [9, 11]
},
"Middle": {
"lifespan": [85, 115],
"health": [350, 450],
"energy": [250, 320],
"luck": [6, 10],
"insight": [6, 10],
"basestrength": [7, 10],
"basewillpower": [6, 9],
"atk": [45, 85],
"def": [6, 10],
"crit": [4, 7],
"critres": [3, 5],
"agility": [8, 12],
"martialArts": [12, 18],
"spiritualRoot": [11, 14]
},
"Late": {
"lifespan": [115, 130],
"health": [500, 700],
"energy": [350, 500],
"luck": [8, 14],
"insight": [10, 16],
"basestrength": [11, 15],
"basewillpower": [10, 14],
"atk": [85, 120],
"def": [12, 18],
"crit": [6, 10],
"critres": [6, 10],
"agility": [12, 18],
"martialArts": [16, 25],
"spiritualRoot": [15, 20]
}
},
"Meridian Awakening Realm": {
"Early": {
"lifespan": [135, 140],
"health": [750, 900],
"energy": [600, 720],
"luck": [10, 14],
"insight": [12, 16],
"basestrength": [16, 20],
"basewillpower": [14, 18],
"atk": [120, 170],
"def": [20, 30],
"crit": [8, 12],
"critres": [8, 12],
"agility": [16, 22],
"martialArts": [24, 32],
"spiritualRoot": [22, 30]
},
"Middle": {
"lifespan": [145, 150],
"health": [1000, 1200],
"energy": [800, 1000],
"luck": [14, 20],
"insight": [18, 24],
"basestrength": [20, 26],
"basewillpower": [18, 24],
"atk": [170, 220],
"def": [28, 40],
"crit": [10, 16],
"critres": [10, 16],
"agility": [22, 30],
"martialArts": [30, 40],
"spiritualRoot": [28, 36]
},
"Late": {
"lifespan": [155, 160],
"health": [1400, 1800],
"energy": [1200, 1600],
"luck": [20, 28],
"insight": [26, 34],
"basestrength": [28, 36],
"basewillpower": [26, 32],
"atk": [220, 270],
"def": [40, 55],
"crit": [14, 20],
"critres": [14, 20],
"agility": [30, 40],
"martialArts": [38, 50],
"spiritualRoot": [35, 45]
}
},
"Qi Condensation Realm": {
"Early": {
"lifespan": [165, 170],
"health": [1900, 2300],
"energy": [1700, 2100],
"luck": [15, 20],
"insight": [20, 26],
"basestrength": [30, 38],
"basewillpower": [28, 35],
"atk": [300, 380],
"def": [45, 65],
"crit": [12, 18],
"critres": [12, 18],
"agility": [35, 45],
"martialArts": [45, 60],
"spiritualRoot": [40, 55]
},
"Middle": {
"lifespan": [175, 185],
"health": [2400, 2900],
"energy": [2200, 2700],
"luck": [20, 28],
"insight": [26, 34],
"basestrength": [38, 48],
"basewillpower": [35, 44],
"atk": [380, 480],
"def": [60, 85],
"crit": [16, 24],
"critres": [16, 24],
"agility": [45, 58],
"martialArts": [58, 75],
"spiritualRoot": [52, 70]
},
"Late": {
"lifespan": [190, 210],
"health": [3000, 3800],
"energy": [2800, 3500],
"luck": [26, 36],
"insight": [34, 44],
"basestrength": [48, 60],
"basewillpower": [44, 55],
"atk": [480, 580],
"def": [80, 110],
"crit": [22, 30],
"critres": [22, 30],
"agility": [55, 70],
"martialArts": [72, 90],
"spiritualRoot": [65, 85]
}
},
"Foundation Establishment Realm": {
"Early": {
"lifespan": [220, 250],
"health": [4200, 5200],
"energy": [3800, 4600],
"luck": [28, 38],
"insight": [38, 50],
"basestrength": [55, 70],
"basewillpower": [50, 65],
"atk": [620, 750],
"def": [100, 135],
"crit": [25, 35],
"critres": [25, 35],
"agility": [65, 82],
"martialArts": [85, 110],
"spiritualRoot": [80, 105]
},
"Middle": {
"lifespan": [255, 290],
"health": [5400, 6800],
"energy": [4800, 5900],
"luck": [35, 48],
"insight": [48, 62],
"basestrength": [68, 85],
"basewillpower": [62, 78],
"atk": [760, 920],
"def": [130, 170],
"crit": [32, 45],
"critres": [32, 45],
"agility": [80, 100],
"martialArts": [105, 135],
"spiritualRoot": [100, 130]
},
"Late": {
"lifespan": [300, 350],
"health": [7000, 8800],
"energy": [6100, 7600],
"luck": [45, 60],
"insight": [60, 78],
"basestrength": [85, 105],
"basewillpower": [78, 95],
"atk": [930, 1120],
"def": [165, 215],
"crit": [40, 55],
"critres": [40, 55],
"agility": [98, 122],
"martialArts": [130, 165],
"spiritualRoot": [125, 160]
}
},
"Core Formation Realm": {
"Early": {
"lifespan": [380, 450],
"health": [9500, 12000],
"energy": [8500, 10500],
"luck": [50, 68],
"insight": [70, 90],
"basestrength": [110, 140],
"basewillpower": [100, 125],
"atk": [1250, 1550],
"def": [220, 290],
"crit": [48, 65],
"critres": [48, 65],
"agility": [120, 150],
"martialArts": [170, 215],
"spiritualRoot": [155, 200]
},
"Middle": {
"lifespan": [460, 550],
"health": [12500, 15800],
"energy": [11000, 13800],
"luck": [65, 85],
"insight": [88, 112],
"basestrength": [135, 170],
"basewillpower": [125, 155],
"atk": [1580, 1950],
"def": [280, 370],
"crit": [60, 80],
"critres": [60, 80],
"agility": [150, 185],
"martialArts": [210, 265],
"spiritualRoot": [195, 245]
},
"Late": {
"lifespan": [560, 700],
"health": [16500, 21000],
"energy": [14500, 18000],
"luck": [80, 105],
"insight": [110, 140],
"basestrength": [165, 210],
"basewillpower": [155, 190],
"atk": [1980, 2450],
"def": [360, 470],
"crit": [75, 100],
"critres": [75, 100],
"agility": [185, 230],
"martialArts": [260, 330],
"spiritualRoot": [240, 300]
}
},
"Nascent Soul Realm": {
"Early": {
"lifespan": [800, 1200],
"health": [24000, 31000],
"energy": [21000, 27000],
"luck": [95, 125],
"insight": [130, 170],
"basestrength": [220, 280],
"basewillpower": [200, 255],
"atk": [2700, 3400],
"def": [480, 620],
"crit": [90, 120],
"critres": [90, 120],
"agility": [240, 300],
"martialArts": [340, 430],
"spiritualRoot": [290, 370]
},
"Middle": {
"lifespan": [1300, 1800],
"health": [32000, 42000],
"energy": [28000, 36000],
"luck": [120, 160],
"insight": [165, 215],
"basestrength": [275, 350],
"basewillpower": [255, 320],
"atk": [3500, 4400],
"def": [610, 790],
"crit": [115, 150],
"critres": [115, 150],
"agility": [300, 375],
"martialArts": [430, 540],
"spiritualRoot": [360, 460]
},
"Late": {
"lifespan": [2000, 3000],
"health": [45000, 60000],
"energy": [39000, 52000],
"luck": [155, 210],
"insight": [210, 270],
"basestrength": [350, 440],
"basewillpower": [320, 400],
"atk": [4600, 5800],
"def": [780, 1000],
"crit": [145, 190],
"critres": [145, 190],
"agility": [380, 480],
"martialArts": [550, 700],
"spiritualRoot": [450, 580]
}
}
}>><div style="max-width:850px; margin:30px auto; line-height:1.8; font-size:1.1em;">
<<set _npc to $currentNPC>>
<h3 style="text-align:center; color:#ffd700; margin-bottom:25px; text-shadow:0 0 10px rgba(255,215,0,0.6);">
Interacting with <<print $currentNPC.fullname>>
</h3>
<!-- TALK -->
<<if $relationAction is "talk">>
<p><<print $currentNPC.fullname>> turns to you, eyes <<if $currentNPC.friendship gte 60>>softening with familiarity<<else>>measuring you carefully<</if>>.</p>
<<if $currentNPC.gender is "female">>
<p><span class="female">"<<print either("What is on your mind, sister?", "You seek me out again... interesting.", "Speak freely. I am listening.", "Your presence brightens this place.")>>"</span></p>
<<else>>
<p><span class="male">"<<print either("What brings you to me?", "State your purpose.", "I have time. Speak.", "Your visits are becoming frequent.")>>"</span></p>
<</if>>
<div id="talk-choices">
<<link "Discuss cultivation">>
<<replace "#talk-choices">>
<p>You share your recent insights on qi circulation and breakthrough difficulties.</p>
<<if $currentNPC.friendship gte 70>>
<p><<print $currentNPC.fullname>> listens intently, then offers thoughtful advice drawn from their own experience.</p>
<p><<if $currentNPC.gender is "female">><span class="female"><<else>><span class="male">
"<<print either("Your foundation is solid. Focus on intent, not force.", "I once faced the same bottleneck. Try circulating reverse for three cycles.", "The Dao rewards patience more than talent.", "You are closer than you think. Trust your dantian.")>>"</span><</if>></p>
<<set $exp += 120>>
<<set $currentNPC.friendship += random(5,12)>>
<<elseif $currentNPC.friendship gte 30>>
<p>They nod occasionally, offering basic tips.</p>
<p><<if $currentNPC.gender is "female">><span class="female"><<else>><span class="male">"Standard methods should suffice at your level."</span><</if>></p>
<<set $exp += 60>>
<<set $currentNPC.friendship += random(3,7)>>
<<else>>
<p>They listen but offer little in return.</p>
<p><<if $currentNPC.gender is "female">><span class="female"><<else>><span class="male">"Such matters are personal. Find your own path."</span><</if>></p>
<<set $currentNPC.friendship += random(1,3)>>
<</if>>
<p>+EXP gained | Friendship <<if $currentNPC.friendship gte 70>>greatly<<elseif $currentNPC.friendship gte 30>>moderately<<else>>slightly<</if>> increased.</p>
<</replace>>
<</link>>
<<link "Ask about their past">>
<<replace "#talk-choices">>
<p>You inquire about their origins and journey.</p>
<<if $currentNPC.internalTrait in ["Wicked", "Selfish", "Evil"]>>
<p>A dark smile plays on their lips as they recount tales of ambition, betrayal, and ruthless advancement.</p>
<<elseif $currentNPC.internalTrait in ["Selfless", "Upstanding", "Kind"]>>
<p>They speak humbly of helping others and overcoming hardship through virtue.</p>
<<else>>
<p>They share a balanced tale of triumphs and losses.</p>
<</if>>
<<if $currentNPC.externalTrait is "Vengeful">>
<p>Their eyes harden when mentioning old enemies. "Some debts can only be paid in blood."</p>
<<elseif $currentNPC.externalTrait is "Romantic">>
<p>A wistful look crosses their face as they recall a lost love.</p>
<<elseif $currentNPC.externalTrait is "Power-hungry">>
<p>"Power is the only truth in this world," they state coldly.</p>
<<elseif $currentNPC.externalTrait is "Family-oriented">>
<p>They speak warmly of siblings or clan members.</p>
<</if>>
<<set $currentNPC.talk += 1>>
<<set $currentNPC.friendship += random(4,10)>>
<</replace>>
<</link>>
<<link "Flirt / Tease">>
<<replace "#talk-choices">>
<<if $currentNPC.depravity gte 40 or $currentNPC.friendship gte 60>>
<p>You lean closer, voice lowering suggestively.</p>
<p><<print $currentNPC.fullname>> <<print either("blushes slightly", "smirks", "meets your gaze steadily", "raises an eyebrow")>>.</p>
<<if $currentNPC.depravity gte 70>>
<p><<if $currentNPC.gender is "female">><span class="female"><<else>><span class="male">
"<<print either("Careful... such words could lead somewhere dangerous.", "Bold. I like that.", "Is that an invitation?", "Keep talking like that and I might not let you leave.")>>"
</span><</if>></p>
<<set $currentNPC.depravity += random(3,8)>>
<<elseif $currentNPC.depravity gte 40>>
<p><<if $currentNPC.gender is "female">><span class="female"><<else>><span class="male">
"<<print either("You are... forward.", "Interesting approach.", "Trying to unsettle me?")>>"
</span><</if>></p>
<<else>>
<p>They clear their throat and change the subject.</p>
<</if>>
<<else>>
<p>Your attempt at flirting falls flat. They respond politely but distantly.</p>
<</if>>
<<set $currentNPC.friendship += random(2,6)>>
<</replace>>
<</link>>
</div>
<<link "Say goodbye">><<goto "RelationsDetailed">><</link>>
<</if>>
<!-- BOND -->
<<if $relationAction is "bond">>
<p>You suggest spending meaningful time together.</p>
<<if $currentNPC.friendship gte 80>>
<p><<print $currentNPC.fullname>> agrees eagerly. You share a quiet meal, watch the sunset from a mountain peak, or meditate side by side.</p>
<p>A deep connection forms - trust solidifies.</p>
<<set $currentNPC.friendship += random(15,25)>>
<<set $exp += 100>>
<<elseif $currentNPC.friendship gte 40>>
<p>They accept. Conversation flows naturally as you walk the sect grounds.</p>
<<set $currentNPC.friendship += random(8,15)>>
<<set $exp += 50>>
<<else>>
<p>They politely decline. "Perhaps another time."</p>
<<set $currentNPC.friendship += random(2,5)>>
<</if>>
<<link "Return">><<goto "RelationsDetailed">><</link>>
<</if>>
<!-- PARTNER -->
<<if $relationAction is "partner">>
<p>You propose becoming cultivation partners - sharing resources, techniques, and possibly more.</p>
<<if $currentNPC.friendship gte 90 and $currentNPC.relationshipType isnot "enemy">>
<p><<print $currentNPC.fullname>>'s eyes shine. "I would be honored to walk this path with you."</p>
<<set $currentNPC.relationshipType to "partner">>
<p>You are now cultivation partners! (Unlocks joint training, shared breakthroughs, possible dual cultivation)</p>
<<elseif $currentNPC.friendship gte 60>>
<p>They consider carefully. "The offer is tempting, but I need more time to know you."</p>
<<set $currentNPC.friendship += 10>>
<<else>>
<p>They shake their head. "We are not yet close enough for such a bond."</p>
<</if>>
<<link "Return">><<goto "RelationsDetailed">><</link>>
<</if>>
<!-- MENTORSHIP -->
<<if $relationAction is "mentorship">>
<<if $currentNPC.realm gt $cultivationRealm or $currentNPC.NPCmartialArts gt $martialArts + 20>>
<p>You humbly request guidance.</p>
<<if $currentNPC.friendship gte 70 and $currentNPC.internalTrait in ["Kind", "Upstanding", "Selfless"]>>
<p>"It would be my pleasure to guide one with such potential."</p>
<<set $currentNPC.mentorshipType to 1>>
<p>You gained a master! (Unlocks advanced techniques, breakthrough assistance)</p>
<<elseif $currentNPC.friendship gte 50>>
<p>"Very well. I will teach you what I can."</p>
<<set $currentNPC.mentorshipType to 1>>
<p>You gained a mentor!</p>
<<else>>
<p>"I do not take students lightly."</p>
<</if>>
<<else>>
<p>You offer to guide them in the Dao.</p>
<<if $currentNPC.friendship gte 60 and $currentNPC.realm lt $cultivationRealm>>
<p>They bow deeply. "This junior would be honored to learn from senior."</p>
<<set $currentNPC.mentorshipType to 2>>
<p>You accepted an apprentice!</p>
<<else>>
<p>They decline gracefully.</p>
<</if>>
<</if>>
<<link "Return">><<goto "RelationsDetailed">><</link>>
<</if>>
<!-- GIFT -->
<<if $relationAction is "gift">>
<p>You present a carefully chosen gift.</p>
<<if $currentNPC.externalTrait is "Glory hound">>
<p>A public, impressive gift would please them most.</p>
<<elseif $currentNPC.externalTrait is "Family-oriented">>
<p>Something sentimental or useful for clan members.</p>
<<elseif $currentNPC.externalTrait is "Romantic">>
<p>A beautiful or intimate item makes their eyes soften.</p>
<</if>>
<p><<print $currentNPC.fullname>> accepts with <<if $currentNPC.friendship gte 50>>genuine pleasure<<else>>polite thanks<</if>>.</p>
<<set $currentNPC.friendship += random(10,25)>>
<<if $currentNPC.depravity gte 60 and $corruption gte 40>>
<p>Their gaze lingers on you with new hunger...</p>
<</if>>
<<link "Return">><<goto "RelationsDetailed">><</link>>
<</if>>
<!-- SPAR -->
<<if $relationAction is "spar">>
<p>You challenge <<print $currentNPC.fullname>> to a friendly duel.</p>
<<if $currentNPC.friendship gte 50 or $currentNPC.externalTrait is "Glory hound">>
<p>"With pleasure!" they accept eagerly.</p>
<p>Techniques clash in a flurry of qi and steel. Sweat glistens, breaths come heavy.</p>
<<if random(1,100) lte 50>>
<p>You emerge victorious! <<print $currentNPC.fullname>> laughs good-naturedly.</p>
<<set $exp += 150>>
<<else>>
<p>They overpower you with superior skill. You learn much from the defeat.</p>
<<set $exp += 100>>
<<set either($insight, $martialArts) += 1>>
<</if>>
<<set $currentNPC.friendship += random(8,18)>>
<<else>>
<p>They decline. "I do not spar lightly."</p>
<</if>>
<<link "Return">><<goto "RelationsDetailed">><</link>>
<</if>>
<!-- DUAL CULTIVATION -->
<<if $relationAction is "dualCultivation">>
<<if $currentNPC.friendship gte 80 and $currentNPC.hadSex neq null and $currentNPC.hadSex eq 1>>
<p>The air thickens with unspoken desire. You suggest merging qi in the most intimate way.</p>
<<if $currentNPC.depravity gte 80>>
<p><<print $currentNPC.fullname>> pulls you close without hesitation. "I've been waiting for this."</p>
<p>(Full NSFW dual cultivation scene - passionate, unrestrained)</p>
<<elseif $currentNPC.depravity gte 50>>
<p>They hesitate only a moment before agreeing, voice husky. "Yes... let us harmonize completely."</p>
<p>(NSFW scene - intense but with some tenderness)</p>
<<else>>
<p>They agree, but with gentle care. "We will take it slow... this is sacred."</p>
<p>(NSFW scene - loving and reverent)</p>
<</if>>
<<set $exp += 400>>
<<set $corruption += random(5,15)>>
<<set $currentNPC.depravity += random(5,12)>>
<p>Major cultivation boost | Deep yin-yang harmony achieved</p>
<<elseif $currentNPC.friendship gte 60 and $currentNPC.depravity gte 40>>
<p>The suggestion hangs heavy. Their eyes darken with interest, but they hold back.</p>
<p>"Tempting... but not yet."</p>
<<set $currentNPC.depravity += random(3,8)>>
<<else>>
<p>They step back, shocked. "Such intimacy requires true trust."</p>
<</if>>
<<link "Return">><<goto "RelationsDetailed">><</link>>
<</if>>
<!-- DEBATE -->
<<if $relationAction is "debate">>
<p>You challenge <<print $currentNPC.fullname>> to a philosophical debate on the nature of the Dao.</p>
<<if $currentNPC.NPCinsight gte $insight + 10>>
<p>Their arguments are sharp and profound. You struggle to keep up.</p>
<p>You gain new perspective despite losing the debate.</p>
<<set $insight += random(1,3)>>
<<set $exp += 80>>
<<elseif $insight gte $currentNPC.NPCinsight + 10>>
<p>Your logic is flawless. They concede multiple points with growing respect.</p>
<<set $currentNPC.friendship += random(10,20)>>
<<set $exp += 120>>
<<else>>
<p>A fierce back-and-forth ensues. Neither gains clear victory, but both learn.</p>
<<set $exp += 100>>
<</if>>
<<link "Return">><<goto "RelationsDetailed">><</link>>
<</if>>
</div><<link "Go back" $passage>><</link>>
<<nobr>>
<<set $currentNPC to []>>
<<set _relationTab to $relationTab || "met">>
<<set _pageSize to 4>>
<div class="relations-container">
<h2 class="relations-title">Book of Connections</h2>
<p class="relations-subtitle">Fated encounters across the myriad realms...</p>
<!-- TAB NAVIGATION -->
<div class="relation-tabs">
<<link "Known (Met)">>
<<set $relationTab to "met">>
<<set $relationPage to 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<<if !document.querySelector('.relations-grid')>>
<<goto "Relations">>
<</if>>
<</link>>
<<link "Discovered (Unmet)">>
<<set $relationTab to "unmet">>
<<set $relationPage to 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<<if !document.querySelector('.relations-grid')>>
<<goto "Relations">>
<</if>>
<</link>>
<<link "Deceased">>
<<set $relationTab to "dead">>
<<set $relationPage to 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<<if !document.querySelector('.relations-grid')>>
<<goto "Relations">>
<</if>>
<</link>>
<<link "All">>
<<set $relationTab to "all">>
<<set $relationPage to 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<<if !document.querySelector('.relations-grid')>>
<<goto "Relations">>
<</if>>
<</link>>
</div>
<<if $known_npc_list.length lte 0>>
<p style="text-align:center; color:#819ca9; font-style:italic; padding:40px;">You walk a solitary path... no connections yet forged.</p>
<<else>>
<!-- Grid container -->
<div class="relations-grid">
<<include "RelationsGrid">>
</div>
<!-- Pagination Container - ALWAYS present, but widget decides what to show -->
<div class="pagination-container">
<<include "RelationsPagination">>
</div>
<</if>>
</div>
<</nobr>>
<div class="tab-nav">
<<link "Status">><<goto "Status">><</link>><<link "Skills">><<goto "Skills">><</link>><<link "Inventory">><<goto "Inventory">><</link>><<link "Relations">><<goto "Relations">><</link>><<link "Breakthrough">><<goto "Breakthrough">><</link>><<link "Help">><<goto "Help">><</link>>
</div><<link "Go back" $passage>><</link>>
<<nobr>>
<!-- SAFETY: If no ID selected, go back -->
<<if !$selectedNPCid>>
<<goto "Relations">>
<</if>>
<!-- Fetch the real NPC from list -->
<<set _npcIndex to $known_npc_list.findIndex(function(n) { return n.id is $selectedNPCid; })>>
<<if _npcIndex lt 0>>
<p style="color:red;">This connection no longer exists.</p>
<<goto "Relations">>
<</if>>
<<set $currentNPC to $known_npc_list[_npcIndex]>>
<<if $treeVisible is undefined>>
<<set $treeVisible = false>>
<</if>>
<div style="text-align:center; margin:15px 0;">
<<if $treeVisible>>
<<link "🌳 Hide Family Tree" "RelationsDetailed">>
<<set $treeVisible = false>>
<</link>>
<<else>>
<<link "🌳 Show Family Tree" "RelationsDetailed">>
<<set $treeVisible = true>>
<<DrawConnectionMap $currentNPC>>
<</link>>
<</if>>
</div>
<div id="tree-container">
<<if $treeVisible>>
<<DrawConnectionMap $currentNPC>>
<</if>>
</div>
<div class="relation-detail-container">
<div class="relation-header">
<img @src="'images/' + $currentNPC.enemyregion + '/' + $currentNPC.enemyimage + '.jpg'" class="relation-portrait" alt="<<print $currentNPC.fullname>>">
<div class="relation-basics">
<h3><<print $currentNPC.fullname>>
<<if $currentNPC.isDead>> <span style="color:#8b0000; font-size:0.8em;">(Deceased)</span><</if>>
</h3>
<p><strong>Sex:</strong> <<print $currentNPC.gender>> •
<<if $currentNPC.isDead>>
<strong>Lifespan at death:</strong> <<print $currentNPC.NPClifespan>> / <<print $currentNPC.NPCmaxlifespan>>
<<else>>
<strong>Lifespan:</strong> <<print $currentNPC.NPClifespan>> / <<print $currentNPC.NPCmaxlifespan>>
<</if>></p>
<p><strong>Realm:</strong> <<print $currentNPC.realm>> • <strong>Position:</strong> <<print $currentNPC.NPCrank>> of <<print $currentNPC.sectNPC>></p>
<p><strong>Traits:</strong> <<print $currentNPC.internalTrait>> • <<print $currentNPC.externalTrait>></p>
<<if !$currentNPC.isDead>>
<p><strong>Location:</strong> <<print $currentNPC.NPClocation>></p>
<</if>>
<p><strong>Relationship:</strong> <<RelationshipType>></p>
</div>
</div>
<<if $currentNPC.hasGrudge and !$currentNPC.isDead>>
<<set _grudgeInfo to $activeGrudges.find(function(g) { return g.avengerId === $currentNPC.id and g.active; })>>
<<if _grudgeInfo>>
<div class="grudge-warning">
<span class="red-text">⚠️ This cultivator holds a grudge against you! ⚠️</span><br>
<<if _grudgeInfo.type eq "rape">>
They seek vengeance for defiling <<print _grudgeInfo.victimName>>.
<<elseif _grudgeInfo.type eq "murder">>
They seek vengeance for the death of <<print _grudgeInfo.victimName>>.
<<elseif _grudgeInfo.type eq "seduction">>
They harbor jealousy over <<print _grudgeInfo.victimName>>.
<<elseif _grudgeInfo.type eq "humiliation">>
They seek to restore their honor after your insult.
<<else>>
They seek justice for your transgression.
<</if>>
<span class="small-text">(Seething with fury)</span>
</div>
<</if>>
<</if>>
<<if !$currentNPC.isDead>>
<<NPCMeter $currentNPC.friendship 100 "Friendship" "#4287f5">>
<<NPCMeter $currentNPC.depravity 100 "Depravity" "#a042f5">>
<</if>>
<p class="relation-flavor">
<<if $currentNPC.isDead>>
<!-- Dead NPC: check for custom death -->
<<if $currentNPC.killedByPlayer>>
<<if $currentNPC.killedInRevenge>>
You ended the life of <<print $currentNPC.fullname>>, who sought vengeance for
<<if $currentNPC.deathGrudgeVictim>>
<<print $currentNPC.deathGrudgeVictim>>
<<else>>
a perceived wrong
<</if>>.
Their blood is on your hands.
<<else>>
You slew <<print $currentNPC.fullname>> in battle. Their spirit may yet seek justice.
<</if>>
<<else>>
<!-- Default death flavor texts (modified to include cause if known) -->
<<set _deadFlavors to []>>
<<if $currentNPC.deathCause eq "old_age">>
<<set _deadFlavors = [
`${$currentNPC.fullname} passed peacefully of old age at ${$currentNPC.NPClocation}.`,
`The jianghu remembers ${$currentNPC.fullname}, who died of natural causes in ${$currentNPC.NPClocation}.`,
`Time claimed ${$currentNPC.fullname} in ${$currentNPC.NPClocation}. Their legend fades but is not forgotten.`
]>>
<<elseif $currentNPC.deathCause eq "murder">>
<<set _deadFlavors = [
`${$currentNPC.fullname} met a violent end at ${$currentNPC.NPClocation}. Whispers say they were ambushed.`,
`A bloodstained jade slip arrived from ${$currentNPC.NPClocation}: ${$currentNPC.fullname} was murdered.`,
`The cultivators of ${$currentNPC.NPClocation} speak of ${$currentNPC.fullname}'s untimely demise with hushed voices.`
]>>
<<else>>
<<set _deadFlavors = [
`The memory of ${$currentNPC.fullname} lingers like incense smoke... they passed from this world at ${$currentNPC.NPClocation}.`,
`A grave somewhere in ${$currentNPC.NPClocation} marks where ${$currentNPC.fullname} fell. Their story continues only in whispers.`,
`The Jianghu moves on, but ${$currentNPC.fullname}'s absence is still felt. They perished at ${$currentNPC.NPClocation}.`,
`Rumors say ${$currentNPC.fullname} met their end at ${$currentNPC.NPClocation}. Some speak of unfinished business...`,
`The soul of ${$currentNPC.fullname} has departed. Only echoes remain where they once walked in ${$currentNPC.NPClocation}.`,
`Ancestral tablets now bear ${$currentNPC.fullname}'s name. They fell at ${$currentNPC.NPClocation}.`,
`The spot where ${$currentNPC.fullname} died at ${$currentNPC.NPClocation} is said to be haunted by their lingering qi.`
]>>
<</if>>
<<print _deadFlavors.random()>>
<</if>>
<<else>>
<!-- Living NPC flavor texts (unchanged) -->
<<set _livingFlavors to [
`You've heard that ${$currentNPC.fullname} is currently at ${$currentNPC.NPClocation}.`,
`Word on the wind says ${$currentNPC.fullname} was last seen near ${$currentNPC.NPClocation}.`,
`Travelers mention spotting ${$currentNPC.fullname} around ${$currentNPC.NPClocation}.`,
`Rumors place ${$currentNPC.fullname} somewhere in ${$currentNPC.NPClocation}.`,
`A merchant claims to have traded with ${$currentNPC.fullname} recently at ${$currentNPC.NPClocation}.`,
`The spiritual energy near ${$currentNPC.NPClocation} bears traces of ${$currentNPC.fullname}'s presence.`,
`Someone matching ${$currentNPC.fullname}'s description was seen entering ${$currentNPC.NPClocation}.`
]>>
<<print _livingFlavors.random()>>
<</if>>
</p>
<!-- Only show interaction buttons if NPC is alive AND in same region -->
<<if !$currentNPC.isDead and $region eq $currentNPC.NPClocation>>
<div class="tab-nav">
<<link "Talk">><<goto "Relations Interactions">><<set $relationAction to "talk">><</link>>
<<link "Bond">><<goto "Relations Interactions">><<set $relationAction to "bond">><</link>>
<<link "Partner">><<goto "Relations Interactions">><<set $relationAction to "partner">><</link>>
<<link "Mentorship">><<goto "Relations Interactions">><<set $relationAction to "mentorship">><</link>>
<<link "Gift">><<goto "Relations Interactions">><<set $relationAction to "gift">><</link>>
<<link "Spar">><<goto "Relations Interactions">><<set $relationAction to "spar">><</link>>
<<link "Dual Cultivation">><<goto "Relations Interactions">><<set $relationAction to "dualCultivation">><</link>>
<<link "Debate">><<goto "Relations Interactions">><<set $relationAction to "debate">><</link>>
</div>
<<elseif $currentNPC.isDead>>
<!-- Memorial interactions for dead NPCs -->
<div class="memorial-actions" style="text-align:center; margin:20px 0; padding:15px; background:rgba(139,0,0,0.1); border-radius:10px;">
<p style="color:#8b0000; font-style:italic;">
<<= [
"You can only visit their grave and pay respects...",
"Their spirit has departed. Only memories remain.",
"The living must honor the dead through remembrance.",
"Perhaps one day you'll avenge them...",
"Their unfinished business calls to you from beyond."
].random() >>
</p>
<<linkreplace "Pay Respects">>
<<set $currentNPC.friendship to 100>>
<<set $exp += 5>>
<span style="color:#ffd700;">You honor their memory. +5 EXP</span>
<</linkreplace>>
</div>
<</if>>
<<BookOfConnections_npcStats>>
<div style="text-align:center; margin-top:30px;">
<<link "Return to Connections">><<goto "Relations">><</link>>
</div>
</div>
<</nobr>><<nobr>>
<<set _tab to $relationTab || "met">>
<!-- Filter based on selected tab -->
<<if _tab eq "met">>
<<set _filteredList to $known_npc_list.filter(n => n.isMet === true and !n.isDead)>>
<<elseif _tab eq "unmet">>
<<set _filteredList to $known_npc_list.filter(n => n.isMet === false and !n.isDead)>>
<<elseif _tab eq "dead">>
<<set _filteredList to $known_npc_list.filter(n => n.isDead === true)>>
<<else>>
<<set _filteredList to $known_npc_list>>
<</if>>
<<set _pageSize to 4>>
<<set _page to $relationPage || 1>>
<<set _totalPages to Math.ceil(_filteredList.length / _pageSize)>>
/* Ensure page is valid */
<<if _totalPages > 0>>
<<if _page > _totalPages>>
<<set _page to _totalPages>>
<<set $relationPage to _page>>
<</if>>
<<else>>
<<set _page to 1>>
<<set $relationPage to 1>>
<</if>>
<<if _page < 1>>
<<set _page to 1>>
<<set $relationPage to 1>>
<</if>>
<<set _start to (_page - 1) * _pageSize>>
<<set _end to Math.min(_start + _pageSize, _filteredList.length)>>
<<set _displayList to _filteredList.slice(_start, _end)>>
<<if _displayList.length gt 0>>
<<for _npc range _displayList>>
<<capture _npc>>
<div @class="'relation-card' + (_npc.isDead ? ' dead-card' : '')">
<div class="relation-name">
<<link _npc.fullname "RelationsDetailed">><<set $selectedNPCid to _npc.id>><</link>>
<<if _npc.isDead>> <span style="color:#8b0000;">✟</span><</if>>
</div>
<div class="relation-info">
<span class="location"><<print _npc.NPClocation>></span><br>
<<if !_npc.isMet and !_npc.isDead>>
<span style="color:#819ca9;">(Discovered but not met)</span><br>
<</if>>
<<RelationshipType>>
</div>
<<if !_npc.isDead>>
<<link "Forget this connection">>
<<RemoveNPC>>
<<goto "Relations">>
<</link>>
<</if>>
</div>
<</capture>>
<</for>>
<<else>>
<p style="text-align:center; color:#819ca9; font-style:italic; grid-column:span 3; padding:40px;">
<<if _tab eq "met">>You haven't met anyone yet...<<elseif _tab eq "unmet">>No discovered connections...<<elseif _tab eq "dead">>No one has passed from this world yet...<<else>>The book is empty...<</if>>
</p>
<</if>>
<</nobr>><<nobr>>
<<set _tab to $relationTab || "met">>
<!-- Filter based on selected tab -->
<<if _tab eq "met">>
<<set _filteredList to $known_npc_list.filter(n => n.isMet === true and !n.isDead)>>
<<elseif _tab eq "unmet">>
<<set _filteredList to $known_npc_list.filter(n => n.isMet === false and !n.isDead)>>
<<elseif _tab eq "dead">>
<<set _filteredList to $known_npc_list.filter(n => n.isDead === true)>>
<<else>>
<<set _filteredList to $known_npc_list>>
<</if>>
<<set _pageSize to 4>>
<<set _page to $relationPage || 1>>
<<set _totalPages to Math.ceil(_filteredList.length / _pageSize)>>
<!-- Ensure page is within bounds -->
<<if _page > _totalPages and _totalPages > 0>>
<<set _page to _totalPages>>
<<set $relationPage to _page>>
<</if>>
<!-- Show count info -->
<div style="text-align:center; color:#819ca9; font-size:0.9em; margin-bottom:10px;">
Showing <<= _filteredList.length >> connection<<if _filteredList.length != 1>>s<</if>>
<<if _totalPages > 1>> (Page <<= _page >> of <<= _totalPages >>)<</if>>
</div>
<!-- Pagination controls - always visible if multiple pages -->
<<if _totalPages > 1>>
<div style="display:flex; justify-content:center; align-items:center; gap:20px;">
<<if _page > 1>>
<<link "« Previous">>
<<set $relationPage to _page - 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<</link>>
<<else>>
<span style="color:#555;">« Previous</span>
<</if>>
<span>Page <<= _page >> of <<= _totalPages >></span>
<<if _page < _totalPages>>
<<link "Next »">>
<<set $relationPage to _page + 1>>
<<replace ".relations-grid">><<include "RelationsGrid">><</replace>>
<<replace ".pagination-container">><<include "RelationsPagination">><</replace>>
<</link>>
<<else>>
<span style="color:#555;">Next »</span>
<</if>>
</div>
<<elseif _filteredList.length gt 0>>
<!-- Single page, show simple indicator -->
<div style="text-align:center; color:#555;">
<span style="color:#555;">« Previous</span>
<span style="margin:0 20px;">Page 1 of 1</span>
<span style="color:#555;">Next »</span>
</div>
<</if>>
<</nobr>><div style="text-align:center;">
<img src="images/Locations/JadeCreekTown.jpg" class="location-bg" style="width:80%; border: 1px solid #c5a059; border-radius: 0;">
<h2 class="town-title">翡翠溪镇</h2> <div style="font-size: 0.9em; color: #c5a059; margin-top:-5px;">— Jade Creek Town —</div>
</div>
<<nobr>>
<<set $city to passage(), $passage to passage(), $pe to 0>>
<<if $health lte 0>><<set $health to 1>><</if>>
/* Mini HUD Bar inside the same width as the grid */
<div style="max-width:400px; margin: 10px auto; display: flex; justify-content: space-between; font-size: 0.75em; border-bottom: 1px solid rgba(197, 160, 89, 0.4); padding-bottom: 3px;">
<span><span style="color:#d4af37;">◈</span> Spirit Stones: $gold</span>
<span><span style="color:#ff4d4d;">❤</span> Health: $health</span>
</div>
<div class="city-grid">
<<link '<span class="nav-card">The Workshop</span>' "The Workshop">><</link>>
<<link '<span class="nav-card">Bounty Board</span>' "Bounty Board">><</link>>
<<link '<span class="nav-card">Tavern</span>' "Tavern">><</link>>
<<link '<span class="nav-card">Inn</span>' "Inn">><</link>>
<<link '<span class="nav-card">Market</span>' "Market">><</link>>
<<link '<span class="nav-card">Public Baths</span>' "Public Baths">><</link>>
<<link '<span class="nav-card">Brothel</span>' "Brothel">><</link>>
<<link '<span class="nav-card exit-btn">Leave Town</span>' "Map|Region1">><</link>>
<<link '<span class="nav-card tournament-btn">⚔ Participate in Tournament ⚔</span>' "Tournament|Region1">><</link>>
</div>
<</nobr>>/* Initialize the view if it doesn't exist yet */
<<if $LonePeakView is undefined>><<set $LonePeakView to "monument">><</if>>
<div class="monument-container">
<<if $LonePeakView is "monument">>
<div class="monument-title">The Stone of Recognition</div>
<p>At its center, a stone slab rises from the earth. Carved into its face are the names of those whose insight, effort, or support helped shape the path you now walk.</p>
<div class="monument-names">
Greeedium<br>
telotelo
</div>
<p style="margin-top: 15px;">— and all others whose hands guided the early climb. —</p>
<<else>>
<div class="monument-title">Altar of Divine Laws</div>
<p>Current World Law Alignment: <span style="color:#d4af37;">**v$CurrentGameVersion**</span></p>
<<if $gameVersion eq $CurrentGameVersion>>
<p style="color:#00ff00;"><b>You are aligned with the current world laws. Your cultivation journey is in harmony with the natural order.</b></p>
<<else>>
<p style="color:#ff0000;"><b>Your cultivation is out of sync with the current world laws. Consider realigning to ensure your progress is not hindered. Your World Law Alignment: <span style="color:#d4af37;">**v$gameVersion**</span></b></p><</if>>
<div class="city-grid" style="max-width:320px; border-color: #d4af37; margin: 0 auto;">
<<link '<span class="nav-card" style="color:#00ffff !important;">✨ Align with v0.16</span>' "LonePeak">>
<<set $gameVersion to 0.16>>
<<GameUpdateWidget-016>>
<</link>>
</div>
<</if>>
<div class="monument-footer">
The wind is still. The mountain watches in silence...
</div>
</div>
<div class="city-grid" style="max-width: 440px;">
<<if $LonePeakView is "monument">>
/* Update the permanent variable and refresh */
<<link '<span class="nav-card">📜 Approach Altar</span>' "LonePeak">>
<<set $LonePeakView to "update">>
<</link>>
<<else>>
<<link '<span class="nav-card">⬅ Back to Names</span>' "LonePeak">>
<<set $LonePeakView to "monument">>
<</link>>
<</if>>
/* When leaving, reset the view so it's back to 'monument' next time you visit */
<<link '<span class="nav-card exit-btn">⬅ Descend Peak</span>' $passage>>
<<set $LonePeakView to "monument">>
<</link>>
</div><<nobr>>
<div id="map-container">
<<MapRender>>
</div>
<div id="event-container">
<<RegionEvents>>
<<NpcPosition>>
<<MortalRealm>>
<<TurnsAge>>
<<MissionNotification>>
<<NPCRumours>>
<<MainStorylineWidget>>
<<AfterBattle>>
<<FameUpdater>>
<<WorldRumours>>
<<CheckRevengeEvents>>
</div>
<div class="tab-nav">
<span data-nokeys="true"><<link "Status">><<goto "Status">><</link>></span>
<span data-nokeys="true"><<link "Skills">><<goto "Skills">><</link>></span>
<span data-nokeys="true"><<link "Inventory">><<goto "Inventory">><</link>></span>
<span data-nokeys="true"><<link "Relations">><<goto "Relations">><</link>></span>
<span data-nokeys="true"><<link "Breakthrough">><<goto "Breakthrough">><</link>></span>
<span data-nokeys="true"><<link "Help">><<goto "Help">><</link>></span>
</div>
<<if $peopleVisible is true>>
<<set $peopleVisible = false>>
<</if>>
<</nobr>><<if $pe eq 0>>
You are currently a <<print $CurrentPcSectRank>> of the <<print $CurrentPcAffiliation>> sect.
<<if $CurrentPcSectRank == "Initiate" and $ContributionPoints >= 50 and $CurrentPcSectReputation >= 10 and $sectFavor >= 5>>
<<link "You can advance to the next rank!" "Council Hall|Stage 1">>
<<set $CurrentPcSectRank to "Disciple">>
<</link>>
<<elseif $CurrentPcSectRank == "Disciple" and $ContributionPoints >= 150 and $CurrentPcSectReputation >= 30 and $sectFavor >= 15>>
<<link "You can advance to the next rank!" "Council Hall|Stage 1">>
<<set $pe to 1>>
<<set $CurrentPcSectRank to "Inner Disciple">>
<</link>>
<<elseif $CurrentPcSectRank == "Inner Disciple" and $ContributionPoints >= 300 and $CurrentPcSectReputation >= 60 and $sectFavor >= 30>>
<<link "You can advance to the next rank!" "Council Hall|Stage 1">>
<<set $pe to 2>>
<<set $CurrentPcSectRank to "Core Disciple">>
<</link>>
<<elseif $CurrentPcSectRank == "Core Disciple" and $ContributionPoints >= 600 and $CurrentPcSectReputation >= 100 and $sectFavor >= 50>>
<<link "You can advance to the next rank!" "Council Hall|Stage 1">>
<<set $pe to 3>>
<<set $CurrentPcSectRank to "True Disciple">>
<</link>>
<<else>>
You have to prove yourself more to get promoted
<</if>>
<<link "Go back" $passage>>
<</link>>
\
\
<<elseif $pe eq 1>>
You have been promoted to <b>Inner Disciple</b>.
To reward your hard work and cultivation, the sect offers you a gift.
<i>You may choose one of the following spiritual consumables:</i>
Refining Pill – Increases your cultivation progress|InnerGiftRefiningPill
Qi Gathering Incense – Boosts next meditation|InnerGiftIncense
2500 Spirit Stones - money
<<link "go back" $passage>><<set $pe to 0>><</link>>
<<elseif $pe eq 2>>
You have been promoted to <b>Core Disciple</b>.
The sect now grants you the honor of choosing a personal mentor among the Elders.
Who will you approach?
<<CreateMentor>>
<<if $CurrentPcSect eq "righteous">><<set _sectAffiliation to "Clear Sky Azure Dragon Pavilion">><<else>><<set _sectAffiliation to "Ghost King Netherworld Sect">><</if>>
<<link _fullname $passage>><<AddNPC>><<if $CurrentPcSect eq "righteous">><<set _npc._sectAffiliation to "Clear Sky Azure Dragon Pavilion">><<else>><<set _npc._sectAffiliation to "Ghost King Netherworld Sect">><</if>><<set $plot1Mentor to clone(_npc)>><</link>> — <<_cultivation>> — <<_sectAffiliation>><br>
<<CreateMentor>>
<<if $CurrentPcSect eq "righteous">><<set _sectAffiliation to "Clear Sky Azure Dragon Pavilion">><<else>><<set _sectAffiliation to "Ghost King Netherworld Sect">><</if>>
<<link _fullname $passage>><<AddNPC>><<if $CurrentPcSect eq "righteous">><<set _npc._sectAffiliation to "Clear Sky Azure Dragon Pavilion">><<else>><<set _npc._sectAffiliation to "Ghost King Netherworld Sect">><</if>><<set $plot1Mentor to clone(_npc)>><</link>> — <<_cultivation>> — <<_sectAffiliation>><br>
<<CreateMentor>>
<<if $CurrentPcSect eq "righteous">><<set _sectAffiliation to "Clear Sky Azure Dragon Pavilion">><<else>><<set _sectAffiliation to "Ghost King Netherworld Sect">><</if>>
<<link _fullname $passage>><<AddNPC>><<if $CurrentPcSect eq "righteous">><<set _npc._sectAffiliation to "Clear Sky Azure Dragon Pavilion">><<else>><<set _npc._sectAffiliation to "Ghost King Netherworld Sect">><</if>><<set $plot1Mentor to clone(_npc)>><</link>> — <<_cultivation>> — <<_sectAffiliation>><br>
pe3 true disciple
You have earned the title of True Disciple. Few reach this far.
<</if>>\
\
<<set _currentRankIndex = $sectRanks.indexOf($CurrentPcSectRank)>>\
<<if $selectedFloor eq null>>\
<<set $selectedFloor = "Initiate">>\
<</if>>\
<div class="floor-selector" style="margin-bottom: 1em;">\
<<link "Go back" $passage>><<set $pe to 0>> <</link>>\
<<if _currentRankIndex gte $sectRanks.indexOf("Initiate")>>
<<link "📘 Floor I" "Manual Library|Stage 1">><<set $selectedFloor = "Initiate">><</link>>\
<</if>>\
<<if _currentRankIndex gte $sectRanks.indexOf("Disciple")>>
<<link "📙 Floor II" "Manual Library|Stage 1">><<set $selectedFloor = "Disciple">><</link>>\
<</if>>\
</div>\
\
<<set _floorRank = $selectedFloor>>\
<<set _floorIndex = $sectRanks.indexOf(_floorRank)>>\
<<set _floorLabel = _floorRank.toUpperCase()>>\
<<if _currentRankIndex >= _floorIndex>>\
\
\
\
<h2 class="floor-header">📜 Manual Library – <<= _floorLabel >></h2>\
<<set _manualList = $sectManuals[$CurrentPcSect][_floorRank]>>\
\
<<if _manualList and _manualList.length > 0>>\
<<for _manual range _manualList>>\
<<capture _manual>>\
<div class="manual-entry" style="border:1px solid #444; border-radius:8px; padding:0.75em; margin-bottom:1em; background:#1a1a1a; color:#e0e0e0;">
<h4 style="margin:0 0 0.2em 0;">\
<<= _manual.name >> \
<span style="font-size: 0.8em; font-weight: normal; color:#aaa;">[<i><<= _manual.category >> Manual</i>]</span>\
</h4>\
<p style="margin:0 0 0.5em 0;"><small><<= _manual.description >></small></p>\
<p style="margin:0 0 0.5em 0;">🪙 <b>Cost:</b> <span style="color:#ffe28a;"><<= _manual.ContributionPointCost >> CP</span></p>\
\
<<set _alreadyKnown = $skillInventory.some(x => x.skillid == _manual.skillid)>>\
\
<<if _alreadyKnown>>\
<div class="manual-note" style="color:#6cff6c;">✔️ You already possess this manual.</div>\
<<else>>\
<<if $ContributionPoints >= _manual.ContributionPointCost>>\
<<link "Learn this Manual" "Manual Library|Stage 1">>\
<<set $ContributionPoints -= _manual.ContributionPointCost>>\
<<set $skillInventory.push(clone(_manual))>>\
You’ve successfully acquired the <<=_manual.name>> manual!
<<replace "#manuals">><<include "ManualLibrary">>\<</replace>>\
<</link>>\
<<else>>\
<div class="manual-note" style="color:#ff6666;">❌ Not enough Contribution Points.</div>\
<</if>>\
<</if>>\
</div>\
<</capture>>\
<</for>>\
\
<<else>>\
<p style="color:#aaa;">📭 No manuals available on this floor.</p>
<</if>>\
\
<<else>>\
<p style="color:#999;">🚫 You do not have permission to access this floor.</p>
<</if>>\
\
<div id="manuals"></div>\<<set _currentRankIndex = $sectRanks.indexOf($CurrentPcSectRank)>>\
\
<<if !$SectSideMissions or $SectSideMissions.length == 0>>
<<refreshMissions>>
<</if>>\
\
<<set _availableMissions = $SectSideMissions.filter(m => {
if (!m.requiredRank) {
return true;
}
return $sectRanks.indexOf(m.requiredRank) <= _currentRankIndex;
})>>\
\
<table class="mission-table">
<tr>
<th>Mission</th>
<th>Description</th>
<th>Reward</th>
<th>Action</th>
</tr>
<<for _mission range _availableMissions>>
<tr>
<td><<print _mission.name>></td>
<td><<print _mission.description>></td>
<td><<print _mission.reward>> contribution points</td>
<td>
<<if $SideMissionStatus is null>>\
<<capture _mission>>\
<<link "Accept" "Mission Hall|Stage 1">><<set $activeSideMission to _mission>><<set $SideMissionStatus to "accepted">><<set $MissionType to "sect">><<set $activeSideMission.missionCordX to $playerX>>\
<<set $activeSideMission.missionCordY to $playerY>><<replace "#missionlog">>Accepted: <<= _mission.name>><</replace>>\
<</link>>\
<</capture>>\
<</if>>\
</td>\
</tr>\
<</for>>\
</table>\
\
<div id="missionlog"></div>\
<<if $activeSideMission neq null>>
Your current mission: <<= $activeSideMission.name >>!
Do you want to abandon your mission?
<<link "Yes" "Mission Hall|Stage 1">>
<<set $activeSideMission to null>>
<<set $SideMissionStatus to null>>
<</link>>\
<</if>>\
\
<<link "⟳ Refresh missions">><<refreshMissions>><<goto "Mission Hall|Stage 1">><</link>>
<<link "Go back" $passage>>
<</link>><<if $pe eq 0>>
<div class="spirit-pavilion">
<h3>🌌 Spirit Pavilion</h3>
<p>You may rent a chamber here and meditate in peace. The cost is <b>3 Contribution Points</b> for <b>1 EXP</b>.</p>
<p><b>You currently have:</b> <span style="color:#ffe28a;"><<= $ContributionPoints >> Contribution Points</span></p>
<label for="spiritInput">How many Contribution Points do you wish to spend?</label><br>
<<textbox "$spiritpavilion" $spiritpavilion size 5>>
<div style="text-align: center;" class="action-btn">
<<link "Meditate">>
<<set $spiritpavilion = parseInt($spiritpavilion)>>
<<if isNaN($spiritpavilion) or $spiritpavilion <= 0>>
<<replace "#meditationResult">><div id="meditationResult" style="color: #ff6666;">⚠️ Please enter a valid number greater than 0.</div><</replace>>
<<elseif $ContributionPoints < $spiritpavilion>>
<<replace "#meditationResult">><div id="meditationResult" style="color: #ff6666;">❌ You do not have enoughContribution Points.</div><</replace>>
<<else>>
<<set _expGained = Math.floor($spiritpavilion / 3)>>
<<set $ContributionPoints -= $spiritpavilion>>\
<<set $exp += _expGained>>\
<<set $pe = 1>>\
<<replace "#meditationResult">>
<div id="meditationResult" style="color: #6cff6c;">✅ You meditated successfully and gained <b><<= _expGained >> EXP</b>.</div>
<</replace>>\
<</if>>\
<</link>>\
<br><<link "Leave" $passage>><<set $pe = 0>><</link>>
</div>
<div id="meditationResult" style="margin-top:1em;"></div>
</div>\
\
\
<</if>>You wandered for a while, but you couldn't found anything interesting!
<<link "Go back" $passage>> <<set $pe to 0>> <</link>><<nobr>>
<<set $origin = passage()>>
<div class="brothel-container">
<div class="location-header" style="text-align:center;">
<img src="images/Locations/Brothel.jpg" class="location-bg" width="80%">
<h2 style="color:#d4af37; text-shadow: 2px 2px 4px #000;">✦ The Crimson Blossom Brothel ✦</h2>
<p style="font-style:italic; color:#b09070;">A sanctuary of earthly delights where incense smoke veils the transaction of spirit stones for fleeting ecstasy.</p>
</div>
<<set _courtesans = []>>
<<for _i = 0; _i lt random(3,4); _i++>>
<<set _gender to ["male","female"].random()>>
<<set _name = (_gender == "male" ? $male_npc_names.random() : $female_npc_names.random())>>
<<set _surname = $npc_surnames.random()>>
<<set _fullname = _surname + " " + _name>>
<<set _price = random(60, 120)>>
<<set _courtesans.push({
fullname: _fullname,
gender: _gender,
charm: random(30,85),
depravity: random(20,90),
skill: random(30,100),
price: _price
})>>
<</for>>
<div class="brothel-actions">
<h3 style="text-align:center; color:#d4af37;">🏮 Tonight's Attendants 🏮</h3>
<div class="grid-2col">
<<for _c range _courtesans>>
<div class="courtesan-card">
<span class="courtesan-name">_c.fullname</span>
<span class="attr-label">Identity:</span> <span class="${_c.gender}">_c.gender</span><br>
<span class="attr-label">Charm:</span> _c.charm | <span class="attr-label">Depravity:</span> _c.depravity<br>
<div class="price-tag">Price: _c.price Spirit Stones</div>
<div style="margin-top:10px;">
<<if $gold gte _c.price>>
<<link "Enter Private Chamber">>
<<set $gold -= _c.price>>
<<set _courtesanObj = {
fullname: _c.fullname,
gender: _c.gender,
id: "courtesan_" + _i + "_" + Date.now()
}>>
<<set $sexPartner = _courtesanObj>>
<<set $sexType = "brothel_hire">>
<<set $sexReturnPassage = $origin>>
<<goto "EncounterInteractionSex">>
<</link>>
<<else>>
<span style="color:#666; font-size:0.9em;">[Insufficient Spirit Stones]</span>
<</if>>
</div>
</div>
<</for>>
</div>
<<if $corruption > 50>>
<div class="work-option">
<h3 style="color:#ff69b4;">💃 Sell Your Services</h3>
<p>The Madam eyes your corrupt aura with approval. You could earn a high price tonight.</p>
<<link "Work the Night Shift">>
<<set $sexPartner = "the Madam's clients">>
<<set $sexType = "brothel_work">>
<<set $sexReturnPassage = $origin>>
<<goto "EncounterInteractionSex">>
<</link>>
</div>
<</if>>
<div style="text-align:center; margin-top:30px;">
<<link "Return to the City Streets" $city>><</link>>
</div>
</div>
<div id="interaction-result"></div>
</div>
<</nobr>><<if $pe eq 0>>
<<set $roomAvailable to random(0,100)>><<if $currentRegion eq "Region1">><<set _regionalCost to 1>><</if>><<set $innStayCost to 50*_regionalCost>>
<<if $roomAvailable lt 30>>
<p>The innkeeper sighs deeply, rubbing his temples.</p>
<p><em>"I'm sorry, but we're fully booked tonight. A merchant caravan arrived just before sunset. Try again next time, maybe some rooms will open up."</em></p>
<<else>>
<p>You push open the creaking wooden doors of the inn. A faint scent of herbal incense hangs in the air.</p>
<p>The innkeeper greets you with a smile. <em>"Welcome, traveler. A good night's rest will restore your strength."</em></p>
<p>Cost: <<print $innStayCost>> spirit stones</p>
<<if $gold gte $innStayCost>><<link "Rent a room and rest" "Inn">><<set $pe to 1>><</link>><<else>><p><em>"You don't have enough coin,"</em> the innkeeper says coldly.</p><</if>>
<</if>>
<<elseif $pe eq 1>>
<p>You sleep soundly through the night. Your body heals and your qi stabilizes. You feel refreshed and restored.</p>
<<set $turns +=2>>
<<set $health = $maxhealth>>
<<set $energy = $maxenergy>>
<<set $gold -= $innStayCost>>
<</if>>\
<<link "Go back" $passage>><<set $pe to 0>><</link>><<if $pe eq 0>>
<<link "Go back" $passage>><<set $pe to 0>><</link>>
You enter the bustling market square, where merchants hawk their wares and the air is thick with the scent of exotic spices and herbs. Colorful stalls line the streets, each offering unique items from across the realm.
<<link "Mysterious Pill Forge" "Market">><<set $pe to 1>><</link>>
<<link "Thunderclap Sword Forge" "Market">><<set $pe to 11>><</link>>
<<link "Bliss Furnace Pavilion" "Market">><<set $pe to 21>><</link>>
<<elseif $pe eq 1>>
<<nobr>>
<br>You approach the Azure Cauldron Pavilion, where a robed pill refiner tends bubbling cauldrons of spiritual elixirs. The air hums with pure qi and the scent of rare herbs.
<div style="margin:20px 0; padding:15px; background:rgba(30,60,100,0.5); border:2px solid #ffd700; border-radius:10px;">
<br><<link "Go back" $passage>><<set $pe to 0>><</link>>
<br><<link "Chat with the alchemist">>
<<set _talk to true>>
<<replace "#chat-output">>The alchemist leans closer with a sly smile and says: <span class="male1">"<<print $azureCauldronChat.random()>>"</span><</replace>><</link>>
<br><span id="chat-output"></span>
<br>
<br><<link "Browse pills" "Market">><<set $pe to 2>><</link>>
</div>
<</nobr>>
<<elseif $pe eq 2>>
<div class="merchant-header">
<h2>The Mysterious Pill Forge</h2>
<p>The air hums with alchemical qi as colorful elixirs glow faintly within jade bottles.</p>
</div>
<<link "Return to Market" "Market">><<set $pe to 0>><</link>>
You open your satchel to reveal your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong>
<<nobr>>
<<if $purchase neq null>>
<p style="color: #4fc3f7; font-weight: bold; margin-top: 20px; text-align: center;">
<br>You have acquired <<print $purchase>>.
</p>
<<unset $purchase>>
<<unset $purchaseclass>>
<</if>>
<</nobr>>
<table class="merchant-table">
<thead>
<tr>
<th>Elixir Offerings</th>
<th style="width: 150px; text-align: center;">Price</th>
<th style="width: 100px; text-align: center;">Purchase</th>
</tr>
</thead>
<tbody>
<<for _i to 0; _i lt $mysteriouspillforgeInventory.length; _i++>>
<<set _item to $mysteriouspillforgeInventory[_i]>>
<tr>
<td>
<div class="item-name"><<print _i + 1>>. <<print _item.name>></div>
<div class="item-desc"><<print _item.description>></div>
</td>
<td style="text-align: center; vertical-align: middle;">
<div class="item-price"><<print _item.price>> Spirit Stones</div>
</td>
<td style="text-align: center; vertical-align: middle;">
<<if _item.price gt $gold>>
<span class="not-enough">Not enough gold</span>
<<else>>
<<capture _item>>
<<link "Buy" "Market">>
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j lt $playerpotioninventory.length; _j++>>
<<if $playerpotioninventory[_j].name === _item.name>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
<<set $playerpotioninventory[_index].quantity += 1>>
<<else>>
<<set _newItem to clone(_item)>>
<<set _newItem.quantity to 1>>
<<set $playerpotioninventory.push(_newItem)>>
<</if>>
/* Deduct gold and show purchase message */
<<set $gold -= _item.price>>
<<set $purchase to _item.name>>
<<set $purchaseclass to _item.class>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<<elseif $pe eq 11>>
<<nobr>>
You approach the Heavenly Edge Armory, where a stern forge master hammers spirit blades to razor perfection. The air crackles with fiery qi and the clash of enchanted steel
<div style="margin:20px 0; padding:15px; background:rgba(30,60,100,0.5); border:2px solid #ffd700; border-radius:10px;">
<br><<link "Go back" $passage>><<set $pe to 0>><</link>>
<br><<link "Chat with the forge master">>
<<set _talk to true>>
<<replace "#chat-output">>The alchemist leans closer with a sly smile and says: <span class="male1">"<<print $thunderClapChat.random()>>"</span><</replace>><</link>>
<br><span id="chat-output"></span>
<br>
<br><<link "Browse weapons" "Market">><<set $pe to 12>><</link>>
</div>
<</nobr>>
<<elseif $pe eq 12>>
<div class="merchant-header">
<h2>Thunderclap Sword Forge</h2>
</div>
<<link "Return to Market" "Market">><<set $pe to 0>><</link>>
You open your satchel to reveal your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong>
<<nobr>>
<<if $purchase neq null>>
<p style="color: #4fc3f7; font-weight: bold; margin-top: 20px; text-align: center;">
<br>You have acquired <<print $purchase>>.
</p>
<<unset $purchase>>
<<unset $purchaseclass>>
<</if>>
<</nobr>>
<table class="merchant-table">
<thead>
<tr>
<th>Weapons Offerings</th>
<th style="width: 150px; text-align: center;">Price</th>
<th style="width: 100px; text-align: center;">Purchase</th>
</tr>
</thead>
<tbody>
<<for _i to 0; _i lt $thunderclapswordforgeInventory.length; _i++>>
<<set _item to $thunderclapswordforgeInventory[_i]>>
<tr>
<td>
<div class="item-name"><<print _i + 1>>. <<print _item.name>></div>
<div class="item-desc"><<print _item.description>></div>
</td>
<td style="text-align: center; vertical-align: middle;">
<div class="item-price"><<print _item.price>> Spirit Stones</div>
</td>
<td style="text-align: center; vertical-align: middle;">
<<if _item.price gt $gold>>
<span class="not-enough">Not enough gold</span>
<<else>>
<<capture _item>>
<<link "Buy" "Market">>
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j lt $weaponInventory.length; _j++>>
<<if $weaponInventory[_j].name === _item.name>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
<<set $weaponInventory[_index].quantity += 1>>
<<else>>
<<set _newItem to clone(_item)>>
<<set _newItem.quantity to 1>>
<<set $weaponInventory.push(_newItem)>>
<</if>>
/* Deduct gold and show purchase message */
<<set $gold -= _item.price>>
<<set $purchase to _item.name>>
<<set $purchaseclass to _item.class>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<<elseif $pe eq 21>>
<<nobr>>
<br>You approach the Bliss Furnace Pavilion, where an eccentric alchemist brews elixirs of passion and desire. The air shimmers with intoxicating fumes and whispers of hidden pleasures.
<div style="margin:20px 0; padding:15px; background:rgba(30,60,100,0.5); border:2px solid #ffd700; border-radius:10px;">
<br><<link "Go back" $passage>><<set $pe to 0>><</link>>
<br><<link "Chat with the alchemist">>
<<set _talk to true>>
<<replace "#chat-output">>The alchemist leans closer with a sly smile and says: <span class="male1">"<<print $blissFurnaceChat.random()>>"</span><</replace>><</link>>
<br><span id="chat-output"></span>
<br>
<br><<link "Browse elixirs" "Market">><<set $pe to 22>><</link>>
<br><<if $gold gte 250>><<link "Yin-Yang Harmony Massage" "Market">><<set $pe to 23>><<set $gold -= 250>><</link>><<else>>Not enough Spirit Stones for Massage <</if>>
<br><<link "Personalized Jade Artifact Fitting" "Market">><<set $pe to 28>><</link>>
</div>
<</nobr>>
<<elseif $pe eq 22>>
<div class="merchant-header">
<h2>Bliss Furnace Pavilion</h2>
</div>
<<nobr>>
<br><<link "Return to Market" "Market">><<set $pe to 0>><</link>>
<br>You open your satchel to reveal your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong>
<<if $purchase neq null>>
<p style="color:#ff69b4; font-weight:bold; text-align:center; margin:20px 0;">
You have acquired <<print $purchase>>.
</p>
<<unset $purchase>>
<</if>>
<</nobr>>
<<nobr>>
<table class="merchant-table">
<thead>
<tr>
<th>Offering</th>
<th style="width:180px;">Description</th>
<th style="width:120px;">Price</th>
<th style="width:100px;">Purchase</th>
</tr>
</thead>
<tbody>
<<for _i to 0; _i lt $blissfurnacepavilionInventory.length; _i++>>
<<set _item to $blissfurnacepavilionInventory[_i]>>
<tr>
<td>
<div class="item-name"><<print _i + 1>>. <<print _item.name>></div>
<<if _item.lewd neq null and _item.lewd>>
<span style="color:#ff69b4; font-size:0.9em;">(Secret Refinement Tool)</span>
<</if>>
</td>
<td><div class="item-desc"><<print _item.description>></div></td>
<td style="text-align:center; vertical-align:middle;">
<span class="item-price"><<print _item.price>> Stones</span>
</td>
<td style="text-align:center; vertical-align:middle;">
<<if _item.price gt $gold>>
<span style="color:#ff4444;">Not enough</span>
<<else>>
<<capture _item>>
<<link "Buy" "Market">>
<<set $gold -= _item.price>>
<<set $purchase to _item.name>>
/* Add to correct inventory */
<<if _item.class is "potion" or _item.class is "consumable">>
<!-- Potions/Consumables -->
<<set _found to false>>
<<for _j range $playerpotioninventory>>
<<if _j.name is _item.name>>
<<set _j.quantity += 1>>
<<set _found to true>>
<<break>>
<</if>>
<</for>>
<<if not _found>>
<<set _new to clone(_item)>>
<<set _new.quantity to 1>>
<<set $playerpotioninventory.push(_new)>>
<</if>>
<<else>>
<!-- Toys/Items (non-consumable) -->
<<set _found to false>>
<<for _j range $playeriteminventory>>
<<if _j.id is _item.id>>
<<set _found to true>>
<<break>>
<</if>>
<</for>>
<<if not _found>>
<<set $playeriteminventory.push(clone(_item))>>
<</if>>
<</if>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<</nobr>>
<<elseif $pe eq 23>>
<<set _meiLingPresent to random(100) gte 50>> /* 50% chance she's absent */
<p>You recline on a heated jade table as Phoenix Tears Oil warms your skin, unblocking meridians...</p>
<<if _meiLingPresent>>
<<goto "Market">><<set $pe to 24>>
<<else>>
<<goto "Market">><<set $pe to 25>>
<</if>>
<<elseif $pe eq 24>>
Mei Ling expertly massages your body, her hands skilled in the art of yin-yang harmony. You feel waves of pleasure and relaxation wash over you as she works her magic.
<<link "Finish the massage" "Market">><<set $pe to 0>><</link>>
<<elseif $pe eq 25>>
<<nobr>>
Lian Feng, a young alchemist , bows deeply: <span class="male1">"Mei Ling rests from qi deviation, honored guest. I shall serve with utmost care."</span>
<p>You lie face-down on the warm jade table, silk towel draped loosely over your hips. The chamber smells of sweet incense and heated oil. Lian Feng stands at your side, pouring Phoenix Tears Oil into his palms.</p>
<p><span class="male1">"Long day of cultivation?"</span> he asks, voice low and steady. <span class="male1">"Your shoulders are knotted tight. Just relax... I'll work it out."</span></p>
<p>His hands land firm on your upper back - strong, callused thumbs digging into tense muscles. The oil is hot, sinking deep. You let out a soft sigh without meaning to.</p>
<p>He pauses for a second. <span class="male1">"There... feel that? Qi starting to move already."</span></p>
<<linkreplace "Murmur 'That feels good'">>
<p><span class="player">"That feels good,"</span> you say softly.</p>
<p>He chuckles quietly. <span class="male1">"Glad to hear it. Let's keep the flow steady."</span></p>
<p>His hands stay focused - long strokes down your spine, pressing along arms and legs. No wandering. Just pure relief as blocked meridians open.</p>
<div class="success-alert">+50 EXP | Full Qi restored </div>
<<set $exp += 50>><<set $energy to $maxenergy>>
<br><<link "Thank him and leave" "Market">><<set $pe to 0>><</link>>
<br><<link "Stay quiet and breathe" "Market">><<set $pe to 26>><</link>><br>
<</linkreplace>>
<</nobr>>
<<elseif $pe eq 26>>
<<nobr>>
<p>You stay quiet, letting your breathing deepen. Lian Feng’s hands slow, becoming more deliberate. His palms slide lower, thumbs brushing the sides of your breasts with each pass.</p>
<p><span class="male1">"Skin like silk,"</span> he mutters, almost to himself. One hand drifts to your ribcage, fingers grazing the soft swell underneath.</p>
<p>Your breath catches - a tiny shiver runs through you. He feels it.</p>
<p><span class="male1">"Sensitive here, huh?"</span> His voice is rougher now, closer to your ear. <span class="male1">"The oil brings everything to the surface."</span></p>
<<set _massageChoice to null>> /* Temporary variable for this decision */
<div id="massage-choices">
<<if $corruption gte 10>>
<<link "Let him continue...">>
<<replace "#massage-choices">>
<p>His confidence grows. The towel slides lower as he works your hips - fingers slipping under the edge, kneading the top of your ass. A low groan escapes you.</p>
<p><span class="male1">"Fuck... you're soaked already,"</span> he whispers, surprised. His palm cups one cheek fully now, squeezing slow. The other hand glides up your side, thumb brushing your nipple as it hardens.</p>
<p><span class="male1">"Tell me to stop if you want,"</span> he says, voice thick, <span class="male1">"but your body's saying something else."</span></p>
<img src="images/Sex/massage.webp" class=center width=600>
<p>Heat pools between your legs.</p>
<p><span class="male1">"Beautiful,"</span> he breathes. One hand spreads your thighs wide; the other traces your folds - finding you already wet.</p>
<div id="massage-choices1">
<<link "That's enough!">><<set $pe to 0>>
<<replace "#massage-choices1">>
<p>You grab his wrist. <span class="player">"That's enough."</span></p>
<p>He stops instantly, breathing hard. <span class="male1">"My apologies."</span> Session ends respectfully.</p>
<div class="success-alert">+70 EXP</div>
<<set $exp += 70>>
<<link "Leave">><<goto "Market">><<if $corruption lt 27>><<set $corruption += 1>><</if>><<set $sexFame += random(2,4)>><<set $pe to 0>><</link>>
<</replace>>
<</link>>
<<if $corruption gte 25>><<link "Let him continue" "Market">><<set $pe to 27>><</link>><</if>>
</div>
<</replace>>
<</link>>
<<link "Protest now">>
<<replace "#massage-choices">>
<p>You shift slightly. <span class="player">"Lian Feng... stick to the meridians."</span></p>
<p>He pulls back at once, clearing his throat. <span class="male1">"Right. My mistake."</span> Hands return to safe territory - firm, professional strokes only.</p>
<div class="success-alert">+65 EXP </div>
<<set $exp += 65>>
<<link "Finish up" "Market">><<set $pe to 0>><<if $corruption lt 30>><<set $corruption += 1>><</if>><<set $sexFame += random(2,4)>><</link>>
<</replace>>
<</link>>
<<else>>
<<replace "#massage-choices">>
<p>You tense and speak firmly. <span class="player">"Lian Feng... stick to the meridians."</span></p>
<p>He withdraws immediately. <span class="male1">"Of course. Forgive me."</span> The rest of the massage stays strictly professional.</p>
<div class="success-alert">+65 EXP</div>
<<set $exp += 65>>
<<link "Finish up" "Market">><<set $pe to 0>><<if $corruption lt 30>><<set $corruption += 1>><</if>><<set $sexFame += random(2,4)>><</link>>
<</replace>>
<</if>>
</div>
<</nobr>>
<<elseif $pe eq 27>>
<<nobr>>
<p>His fingers slide inside you - slow at first, then deeper, curling just right. You gasp as he adds a second, stretching you.</p>
<img src="images/Sex/massage1.webp" class="nsfw-glow">
<p><span class="male1">"Fuck, you're tight,"</span> he groans. Thumb circles your clit while his fingers pump steadily. Your hips buck; wetness coats his hand.</p>
<p>He flips you back over, ass in the air. Strong hands grip your cheeks, spreading you open as three fingers thrust deep from behind.</p>
<img src="images/Sex/massage2.webp" class="nsfw-glow">
<p>You moan into the table, pushing back against his hand. He growls, <span class="male1">"You want more, don't you?"</span></p>
<div id="massage-choices">
<<if $corruption gte 30>>
<<link "Let him continue...">>
<<replace "#massage-choices">>
<p>Lian Feng can't hold back anymore. He sheds his robe - cock thick and hard, dripping at the tip. He lines up behind you, rubbing against your soaked entrance.</p>
<p><span class="male1">"Need to be inside you,"</span> he says roughly, pushing in slow. You cry out as he stretches you completely.</p>
<img src="images/Sex/massage3.webp" width="60%" class="nsfw-glow">
<p>He starts thrusting - deep, steady strokes that make the table creak. Hands grip your hips hard, pulling you back onto him with every slam.</p>
<p><span class="male1">"So fucking good,"</span> he groans. Pace turns brutal - skin slapping, oil flying. You push back desperately, taking him deeper.</p>
<p>Pleasure builds fast. You come hard, walls clenching around him. He follows with a roar, burying deep and filling you with hot pulses.</p>
<p>Qi explodes between you - pure yang flooding yin in perfect harmony.</p>
<div class="success-alert" style="color:#ff4500;">
+80 EXP
</div>
<<set $exp += 80>>
<<if $corruption lt 50>><<set $corruption += 2>><<set $sexFame += random(2,4)>><</if>>
<<link "Collapse spent">><<goto "Market">><<if $virginity eq 1>><<set $virginity = 0>><<set $virginityLost = "Masseur">><<set $sexFame += random(2,4)>><</if>><<set $pe to 0>><</link>>
<</replace>>
<</link>>
<</if>>
<<link "Protest now">>
<<replace "#massage-choices">>
<p>You shake your head. <span class="player">"Stop... please."</span></p>
<p>He pulls out slowly, breathing ragged. <span class="male1">"As you wish."</span> Massage ends here.</p>
<div class="success-alert">+65 EXP</div>
<<set $exp += 65>>
<<link "Leave flushed">><<goto "Market">><<set $pe to 0>><<set $sexFame += random(2,4)>><<if $corruption lt 37>><<set $corruption += 1>><</if>><</link>>
<</replace>>
<</link>>
</div>
<</nobr>>
<<elseif $pe eq 28>>
<<nobr>>
<<if $corruption lt 15>>
<p>The alchemist leads you to a silk-draped side chamber lined with polished jade artifacts of various shapes and sizes.</p>
<p><span class="male1">"These are personalized meridian probes,"</span> he explain calmly. <span class="male1">"Crafted to fit your body's unique qi flow. They help relieve stress, unblock stagnant meridians, and refine yin essence in private cultivation."</span></p>
<p><span class="male1">"Many disciples use them for solo refinement. Nothing shameful - merely a tool for progress."</span></p>
<p>You nod, understanding the purpose, but feel a faint warmth in your cheeks. The idea is... intriguing, yet you are not quite ready to indulge.</p>
<p><i>(Requires Corruption 15+ to proceed with fitting)</i></p>
<br><<link "Go back" "Market">><<set $pe to 0>><</link>>
<<else>>
<p>The alchemist guides you behind heavy silk curtains into a warmly lit fitting chamber. Dozens of jade artifacts gleam on velvet cushions - smooth rods, tapered plugs, beaded chains, all pulsing faintly with contained qi.</p>
<p><span class="male1">"Welcome to true personalization,"</span> he say with a knowing smile. <span class="male1">"We will measure your meridians and craft a probe perfectly suited to your body. It will become your most intimate cultivation tool."</span></p>
<p>You feel heat rising - not from embarrassment, but anticipation. Your corruption has awakened curiosity you can no longer deny.</p>
<<link "Return to Pavilion">><<goto "Market">><<set $pe to 0>><</link>>
<h3 style="color:#ff69b4; margin:30px 0 20px;">Choose Your Artifact Type</h3>
<<set _customfittingblissfurnaceinventory to []>>
<<set _customfittingblissfurnaceinventory.push($jadeprobe, $phoenixfeatherplug, $lotusbeads
)>>
<div style="display:grid; grid-template-columns:1fr 1fr; gap:25px; margin-bottom:30px;">
<<for _i to 0; _i lt _customfittingblissfurnaceinventory.length; _i++>>
<<set _item to _customfittingblissfurnaceinventory[_i]>>
<tr>
<td>
<div class="item-name"><<print _i + 1>>. <<print _item.name>></div>
<div class="item-desc"><<print _item.description>></div>
<span style="color:#ff1493; font-size:0.9em;">(Private Yin Refinement Tool)</span>
</td>
<td style="text-align:center;">
<<print 350>> Stones<br>
<span style="font-size:0.9em; color:#ff69b4;">+ Personal Fitting</span>
</td>
<td style="text-align:center;">
<<if $gold lt 350>>
<span style="color:#ff4444;">Not enough</span>
<<elseif $corruption lt 15>>
<span style="color:#ff69b4;">(Corruption 15+ required)</span>
<<else>>
<<capture _item>>
<<link "Purchase & Fit">>
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j lt $playeriteminventory.length; _j++>>
<<if $playeriteminventory[_j].name === _item.name>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
<<set $playeriteminventory[_index].quantity += 1>>
<<else>>
<<set _newItem to clone(_item)>>
<<set _newItem.quantity to 1>>
<<set $playeriteminventory.push(_newItem)>>
<</if>>
/* Deduct gold and show purchase message */
<<set $gold -= 350>>
<<set $purchase to _item.name>>
<<set $purchaseclass to _item.class>>
<<goto "Market">><<set $pe to 29>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
<</if>>
<</nobr>>
<<elseif $pe eq 29>>
<<nobr>>
<p><span class="male1">"Now... let us ensure perfect fit."</span></p>
<p>The alchemist closes the silk curtain behind you, sealing the chamber in warm, dim light scented with aphrodisiac incense.</p>
<p><span class="male1">"For true personalization,"</span> he say in a low, professional tone, <span class="male1">"we must first measure your body's natural response. Lie back on the jade table and relax."</span></p>
<p>You recline as instructed. The cool stone against your bare back sends a shiver through you. The alchemist gently lifts your knees and spreads your legs wide, exposing you completely to their calm, practiced gaze.</p>
<img src="images/Sex/toyfitting.webp" class="nsfw-glow">
<p>Strong hands hold your thighs open as they lean in close, studying every intimate detail with clinical focus that gradually turns heated.</p>
<p><span class="male1">"Beautiful structure,"</span> he murmur, voice dropping. <span class="male1">"Petals flushed and already glistening. Your yin gate responds eagerly to exposure."</span></p>
<p>A gloved finger traces your outer lips lightly, parting them to reveal the slick pink within. You bite your lip as cool air meets wet heat.</p>
<p><span class="male1">"Sensitive here,"</span> he note, brushing your swollen clit once - just enough to make your hips twitch. <span class="male1">"And here..."</span> Two fingers spread you wider, opening your entrance fully to inspection.</p>
<p>He press gently at your hole, testing resistance. <span class="male1">"Tight, yet yielding. Perfect depth for deep refinement. You will take a full probe easily."</span></p>
<p>Another slow circle around your clit, deliberate now. <span class="male1">"Natural lubrication abundant. Your body is ready for pleasure cultivation."</span></p>
<p>Finally, he withdraws, eyes dark with restrained hunger. <span class="male1">"Measurements complete. Your meridians sing with need."</span></p>
<<set $corruption += random(2,3)>>
<<set _lastToy to $purchase>> <!-- Uses the name from purchase -->
<<linkappend "The alchemist presents your custom <<print $purchase>>">>
- perfectly matched to your depth and girth preference.
<<if _lastToy eq "Jade Meridian Probe">>
<p><span class="male1">"Use it freely in private. It will bring powerful yin refinement... and pleasure."</span></p>
<<elseif _lastToy eq "Phoenix Feather Anal Plug">>
<p><span class="male1">"This one will awaken your rear meridians,"</span> he murmurs. <span class="male1">"Breathe slow and push back when you feel pressure."</span></p>
<p>You feel the cool tip press against your tight ring. A steady, gentle push follows - the jade slides in smoothly, stretching you open inch by inch until the widest part pops past the resistance and seats deep inside.</p>
<p>Warm yang fire instantly spreads through forbidden channels. The soft feathers brush your sensitive skin with every tiny movement, sending shivers up your spine.</p>
<p><span class="male1">"Perfect fit,"</span> he praises, giving the base a light tug that makes you gasp. <span class="male1">"Your body accepts it greedily."</span></p>
<<elseif _lastToy eq "Lotus Prayer Beads">>
<p>The alchemist lays out the string of graduated rose quartz beads, each one larger than the last, polished to a silky sheen.</p>
<p><span class="male1">"We insert them one by one,"</span> He explains softly. <span class="male1">"Feel each bead stretch and settle before the next."</span></p>
<p>Cool oil drips between your cheeks. The smallest bead presses in easily - then the next, larger one forces a soft moan from your lips as it stretches your ring wider.</p>
<p>One after another they disappear inside you, each pop sending a pulse of yin qi through your body. By the time the largest bead seats deep, you feel deliciously full, every slight shift tugging at sensitive nerves.</p>
<p>The alchemist gives the loop at the end a gentle pull - the beads shift inside, making your hips buck involuntarily.</p>
<p><span class="male1">"Exquisite response,"</span> he whispers. <span class="male1">"Your meridians are wide open now."</span></p>
<</if>>
<p>You acquired: _lastToy</p>
<<link "Return to Pavilion">><<goto "Market">><<set $pe to 0>><</link>>
<</linkappend>>
<</nobr>>
<<elseif $pe eq 30>>
<<set $corruption += random(2,3)>>
<<linkappend "The alchemist carefully coats the tapered jade plug.">>
<p><span class="male1">"This one will awaken your rear meridians,"</span> they murmur. <span class="male1">"Breathe slow and push back when you feel pressure."</span></p>
<p>You feel the cool tip press against your tight ring. A steady, gentle push follows - the jade slides in smoothly, stretching you open inch by inch until the widest part pops past the resistance and seats deep inside.</p>
<p>Warm yang fire instantly spreads through forbidden channels. The soft feathers brush your sensitive skin with every tiny movement, sending shivers up your spine.</p>
<p><span class="male1">"Perfect fit,"</span> they praise, giving the base a light tug that makes you gasp. <span class="male1">"Your body accepts it greedily."</span></p>
<p>You acquired: Phoenix Feather Anal Plug<br></p>
<<link "Return to Pavilion">><<goto "Market">><<set $pe to 0>><</link>>
<</linkappend>>
<<elseif $pe eq 31>>
<<set $corruption += random(2,3)>>
<<linkappend "The alchemist lays out the string of graduated rose quartz beads">>, each one larger than the last, polished to a silky sheen.
<p><span class="male1">"We insert them one by one,"</span> they explain softly. <span class="male1">"Feel each bead stretch and settle before the next."</span></p>
<p>Cool oil drips between your cheeks. The smallest bead presses in easily - then the next, larger one forces a soft moan from your lips as it stretches your ring wider.</p>
<p>One after another they disappear inside you, each pop sending a pulse of yin qi through your body. By the time the largest bead seats deep, you feel deliciously full, every slight shift tugging at sensitive nerves.</p>
<p>The alchemist gives the loop at the end a gentle pull - the beads shift inside, making your hips buck involuntarily.</p>
<p><span class="male1">"Exquisite response,"</span> they whisper. <span class="male1">"Your meridians are wide open now."</span></p>
<p>You acquired: Lotus Prayer Beads<br></p>
<<link "Return to Pavilion">><<goto "Market">><<set $pe to 0>><</link>>
<</linkappend>>
<</if>><<if $pe eq 0>>
<img src="images/Locations/BathHouse.jpg" class=center width=600>
You step beneath the curved archway of the bathhouse, where steam curls lazily from the open roof. The scent of lotus flowers and mineral-rich springs wafts through the air, blending with the warm aroma of aged wood and faint medicinal herbs.
A delicate chime rings above the entrance as you push aside the bamboo curtain. Inside, soft light glows from spirit stones embedded in the walls, casting gentle reflections on the polished stone floor.
<<set _random to random(0,1)>>\
<<if _random eq 0>>\
Behind a low counter sits a slender woman in light crimson robes, a jade ornament pinned to her hair. Her eyes lift to meet yours—measured, slightly amused, and unmistakably aware of your gaze.
<span class="female">"Welcome to the Moonveil Springs, traveler. You look like you’ve carried dust and spirit strain from the road... or a fight."</span>
She gestures toward a lacquered board displaying prices written in flowing calligraphy.
<span class="female">"Private pool: ten spirit stones. Communal bath: three."</span>
<<else>>\
Behind a low wooden counter sits a man in dark, well-fitted robes. His sleeves are loosely rolled up, revealing calloused forearms marked with faint spirit script. A single strand of black hair falls across his sharp eyes as he regards you—calm, calculating, with the faintest hint of a smirk tugging at his lips.
<span class="male">"You’ve got the look of someone who’s fought more than just beasts today."</span>
He leans forward slightly, voice smooth like aged wine.
<span class="male">"Communal bath is three spirit stones. Private spring’s ten."</span>
<</if>>
<<link "Go back" $passage>><<set $pe to 0>><</link>>
<<linkappend "Private Bath">>
<<if $gold gte 10>><<goto "Public Baths">>
<<set $pe to 1>>
<<set $gold -=10>>
<<else>>You don't have enough spirit stones!<</if>>
<</linkappend>>
<<linkappend "Communal bath">>
<<if $corruption gt 10 and $gold gte 3>><<goto "Public Baths">><<set $pe=10>><<elseif $corruption gt 10 and $gold lt 3>>You don't have enough spirit stones!<<elseif $corruption lte 10>><span class="player">What am I even thinking?</span><</if>>
<</linkappend>>
<<elseif $pe eq 1>>
The attendant leads you to a side corridor and slides open a paper door carved with phoenix patterns.
Inside, the private spring glows faintly from embedded spirit stones. Mist curls around the edges of the stone pool like spirit snakes. The scent of plum blossoms and sandalwood fills the air.
<<linkappend "You’re finally alone.">>
You step onto the smooth stone floor beside the steaming water. The silence is calming. Your fingers trace the knot of the towel at your hip.
<span id="choice1">
<<linkreplace "Gently lower yourself into the water, towel still on.">>
<<replace "#choice2">><</replace>>
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;">
<img src="images/Sex/bath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
</div>
You let the warmth soak through the cloth, your body relaxing slowly. The towel floats faintly around you, growing more transparent with every second. A quiet moment of solitude. You close your eyes and breathe in deep.
<span class="healthy">You've recovered part of your health and qi.</span>
<<if $health lt $maxhealth or $energy lt $maxenergy>><<set $health to ($health += $health*0.1)>> <<set $energy to ($energy += $energy*0.1)>><<if $health gte $maxhealth>><<set $health to $maxhealth>><</if>><<if $energy gte $maxenergy>><<set $energy to $maxenergy>><</if>><</if>>
<<link "Finish bathing" "Public Baths">><<set $pe to 0>><</link>>
<</linkreplace>>\
</span>\
\
<span id="choice2">
<<linkreplace "Remove the towel, letting it fall before entering naked.">>\
<<replace "#choice1">><</replace>>\
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;"><<set _random=random(0,1)>><<if _random eq 0>>
<img src="images/Sex/nakedbath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><<else>><img src="images/Sex/nakedbath1.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><</if>>
</div>
With a flick of your fingers, the towel slides down your body and falls silently to the floor. The air brushes your bare skin, and the rising steam embraces you like a lover’s breath.
You step into the water, feeling the heat soak into every part of you. Free. At peace.
You settle against the smooth stone edge, letting your arms drape lazily over the rim. Steam clings to your skin in droplets, tracing paths down the gentle curves of your breasts, the dip of your stomach, the soft flesh between your thighs.
<span class="healthy">You've recovered part of your health and qi.</span>
<<link "Finish bathing" "Public Baths">><<set $pe to 0>><</link>>
<<if $health lt $maxhealth or $energy lt $maxenergy>><<set $health to ($health += $health*0.1)>> <<set $energy to ($energy += $energy*0.1)>><<if $health gte $maxhealth>><<set $health to $maxhealth>><</if>><<if $energy gte $maxenergy>><<set $energy to $maxenergy>><</if>><</if>>
<<linkappend "You feel a slow, warm ache between your thighs...">>
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;"><<set _random=random(0,1)>>
<img src="images/Sex/masturbation_bath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
</div>
Your fingers drift underwater, trailing along your inner thigh. There’s no one here.
Your hand slides between your legs, parting the folds of your pussy with practiced ease. The water only amplifies the sensation—heat kissing your skin, your clit pulsing softly under your touch.
You circle it slowly, teasing yourself with delicate strokes. Pleasure flutters through your core, subtle at first… but growing. You tilt your head back, lips parting with a quiet sigh as you press in deeper.
Two fingers slip past your entrance, spreading your slick folds beneath the surface. You curl them slightly inside yourself, your breath catching as you hit just the right spot. The soft slap of water echoes faintly with every motion of your hips. The rhythm builds—slow, wet, steady.
Your free hand cups your breast, thumb brushing across a hardened nipple. You moan this time—quiet but unashamed. The sound disappears into the steam, claimed by the silence of the room.
Each thrust of your fingers drives the heat higher. Your clit throbs beneath your touch, swollen and needy, aching for release. You rub it faster now, your thighs tensing around your hand.
Pressure coils inside you—tight, hot, irresistible. The peak rushes toward you like qi flooding a meridian.
And then—
You come with a soft cry, legs trembling in the water, pleasure tearing through you like a quiet storm. Your back arches, your walls clenching greedily around your fingers as wave after wave crashes through your body.
You collapse back against the stone, chest rising and falling, fingers still lazily nestled between your thighs.
The water calms again, rippling gently as if it too is catching its breath.
<<link "Finish bathing" "Public Baths">><<set $pe to 0>><<if $corruption lt 15>><<set $corruption +=1>><</if>><</link>>
<</linkappend>>
<</linkreplace>>\
</span>\
<</linkappend>>
<<elseif $pe eq 10>>
You step into the steamy chamber of the communal bath. The room is filled with the soft murmur of voices, the splash of water, and the scent of heated minerals.
Smooth stone tiles line the hot spring pool, its edges decorated with dragon-shaped spouts that pour steaming water into the crystal-clear basin. A handful of cultivators lounge in the pool—some meditating in silence, others casually conversing in hushed tones.
You feel the warmth wrap around your body through the thin bath towel provided. Moisture clings to your skin already, making it stick slightly. A few glances are thrown your way, subtle and brief… though one lingers.
You approach the water’s edge.
<span id="choice1">
<<linkreplace "Keep the towel on and slide into the water.">>
<<replace "#choice2">><</replace>>
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;">
<img src="images/Sex/bath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
</div>
You sink into the warmth slowly, the towel still clinging loosely to your body. It becomes translucent as it soaks, and you catch more than one curious glance from the others. Whether it's respect or something else, it's hard to tell in the rising steam.
<span class="healthy">You've recovered part of your health and qi.</span>
<<if $health lt $maxhealth or $energy lt $maxenergy>><<set $health to ($health += $health*0.1)>> <<set $energy to ($energy += $energy*0.1)>><<if $health gte $maxhealth>><<set $health to $maxhealth>><</if>><<if $energy gte $maxenergy>><<set $energy to $maxenergy>><</if>><</if>>
<<link "Finish bathing" "Public Baths">><<set $pe to 0>><<if $corruption lt 25>><<set $corruption +=1>><</if>><</link>>
<</linkreplace>>\
</span>\
\
<span id="choice2">
<<linkreplace "Let the towel fall and step in naked.">>\
<<replace "#choice1">><</replace>>\
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;"><<set _random=random(0,1)>><<if _random eq 0>>
<img src="images/Sex/nakedbath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><<else>><img src="images/Sex/nakedbath1.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><</if>>
</div>
You untie the towel and let it drop to the smooth stone without hesitation. The steam caresses your bare skin as you step confidently into the water. A nearby cultivator—one with a jade pin in her hair—lets her eyes flick to you briefly, then back again.
<span class="female">"Brave or bold,"</span> she murmurs to herself, just loud enough for you to hear.
You settle into the warm waters, letting the steam and heat melt away tension from your limbs. The crystalline surface ripples as you stretch, utterly bare beneath the rising mist. Around you, soft conversations drift in and out like incense smoke, but your mind floats in calm silence.
<span class="healthy">You've recovered part of your health and qi.</span>
<<set _chance = random(0,100)>>
<<if _chance lte 99>>
Until someone joins you.
<img src="images/Sex/bathev.jpg" style="width: 100%">
The water shifts subtly. A figure enters the pool on your left—tall, well-built, his bare torso still glistening from the mist. His face is unfamiliar, but his gaze lingers just a little too long on your body before he speaks.
<span class="male">"Didn’t think I’d find someone so bold in a place like this,"</span>he says, voice smooth like oiled silk, with a smirk that suggests he's no stranger to indulgence.
<span class="male">"Not every day you see someone that comfortable in their skin... but I like it."</span>
He leans in slightly, not close enough to touch, but close enough to make his presence feel intentional.
His tone lowers, just enough to make it feel <i>sensual</i>.
<span class="male">"You look like someone who knows how to... ease tension. How about lending a hand? I’ll make it worth your while."</span>
He shifts beneath the water slightly. From the faint ripples—and the way his eyes lock on yours—you know exactly what he means.
<div id="choice3">
<<if $corruption gt 25>><<link "Accept his offer and reach beneath the water.">>
<<replace "#choice3">>
<<set _randomHJ =random(0,3)>>
<div style="position: relative; width: 70%; height: auto;">
<img src="images/Background/publicbath.jpg" style="width: 100%; display: block;"><<set _random=random(0,1)>><<if _randomHJ eq 0>>
<img src="images/Sex/handjob_bath.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><<elseif _randomHJ eq 1>><img src="images/Sex/handjob_bath1.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><<elseif _randomHJ eq 2>><img src="images/Sex/handjob_bath2.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><<elseif _randomHJ eq 3>><img src="images/Sex/handjob_bath3.png" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><</if>>
</div>
The water around you shifts as you scoot a little closer, letting your knee brush against his beneath the surface. His smirk fades, replaced with a breathless stillness as he watches your hand disappear beneath the steaming surface.
Your fingers glide across the warmth of his thigh—firm, tense—before you wrap them slowly around his cock. Hard. Hot. Already twitching with need beneath the water.
He exhales sharply. <span class="male">“Fuck…”</span>
The sound of it, ragged and low, makes heat coil in your belly.
You stroke him slowly at first, your movements masked by the gentle ripples of the bathwater.
His head tips back slightly, jaw tight, chest rising with sharp breaths.
<span class="male">"Shit—gods, your hand…"</span> he mutters, voice hoarse. <span class="male">"You're better than half the courtesans in Golden Silk Pavilion..."</span>
You smirk, your fingers tightening just slightly, giving him a slow, deliberate pump that earns a low groan from his throat.
Around you, the bathhouse continues—unaware or uncaring of what’s happening just beneath the surface. Maybe someone knows. Maybe they’re watching.
He shifts closer, one hand gripping the edge of the stone, muscles taut.
<span class="male">“Fuck—don’t stop. Just like that...”</span>
Your strokes grow faster, firmer. His cock throbs in your hand, slick now from a mix of precum and water, and you feel him twitch violently as his breath grows uneven.
<span class="male">"I'm gonna—fuck—"</span>
He jerks forward just slightly, and with a soft grunt, he spills into the water—hot spurts lost in the steam, his hips trembling beneath your hand.
You let go slowly, dragging your fingers up his length one last time before retracting your hand, watching the way his chest heaves and his lips part with dazed satisfaction.
He leans in, whispering with a lopsided grin.
<span class="male">“Remind me never to underestimate anyone in this bathhouse again.”</span>
<<link "Finish bathing" "Public Baths">><<set $pe to 0>><<set $sexFame += random(2,4)>><<if $corruption lt 35>><<set $corruption +=1>><</if>><</link>>
<</replace>><</link>><</if>>
<<if $corruption gt 10>><<link "Smirk but only tease him">>
<<replace "#choice3">>
You give him a slow look, deliberately trailing your gaze down his chest.
<span class="player">"You’ll have to try harder than that to earn a touch from me."</span>He chuckles, raising his hands in mock surrender.
<span class="male">"Fair enough. But I’m not giving up just yet."</span>
<<link "Finish bathing" "Public Baths">><<set $sexFame += 1>><<set $pe to 0>><<if $corruption lt 15>><<set $corruption +=1>><</if>><</link>>
<</replace>> <</link>><</if>>
<<link "Politely decline">>
<<replace "#choice3">>
You meet his eyes and offer a calm smile.
<span class="player">"I came here to relax, not to serve."</span>
He raises an eyebrow but nods, backing off without offense.
<span class="male">"Respect. Maybe another time, then."</span>
<<link "Finish bathing" "Public Baths">> <<set $pe to 0>> <</link>>
<</replace>><</link>>
</div>
<<else>>
No one interfered with your relax...
<<link "Finish bathing" "Public Baths">><<set $pe to 0>> <</link>>
<</if>>
<</linkreplace>>\
</span>\
\
\
\
<</if>><<set _currentpassage to passage()>>
<<if $pe eq 0>>
<br>The air is thick with the scent of spiritual wine and the low hum of cultivators discussing the Dao.
<br><<if $fame gt 50>>
The rowdy crowd settles as you enter. A few rogue cultivators nudge each other, whispering about your recent exploits.
<br><<else>>
No one looks up as you enter. To them, you are just another wandering soul seeking a moment's respite.
<</if>>
<hr>
<div id="gossip-area">
<<link "Buy a jar of wine and listen to gossip (5 Spirit Stones)">>
<<set $gold -= 5>>
<<set $energy += 5>>
<<replace "#gossip-area">>
<<TavernGossip>>
<</replace>>
<</link>>
</div>
<<set _roll to random(1, 100)>>
<<if _roll lte 15>>
/* Positive Outcome */
<p>A troupe of musicians plays a song of the ancient Sects. The harmonic resonance aligns your meridians.</p>
<span class="gold">You feel invigorated! (+10 Energy)</span>
<<set $energy += 10>>
<<elseif _roll lte 30>>
/* Interaction Outcome */
<p>A drunken brute slams his jug down. "You! Woman! You look like you can handle your liquor. Care to bet on a contest?"</p>
<<linkreplace "Accept the challenge">>
<<set _physique to random(1, 10)>>
<<if _physique + ($cultivationLevel) gt 8>>
<p>You drain the jug without blinking. The brute laughs and toasts to your name!</p>
<span class="green">Your fame spreads. (+5 Fame)</span>
<<set $fame += 5>>
<<else>>
<p>The spiritual wine is too potent. Your vision swims, and you collapse into a heap.</p>
<span class="red">How embarrassing. (-5 Energy, -2 Fame)</span>
<<set $energy -= 5>><<set $fame -= 2>>
<</if>>
<</linkreplace>>
<<elseif _roll lte 45>>
/* Trigger the Arrogant Young Master */
<p>The atmosphere suddenly chills. A young man in silk robes is berating a server. His eyes lock onto you with predatory interest.</p>
<<link "Approach the commotion" "Arrogant Young Master Tavern">><<set $pe to 0>><</link>>
<<else>>
<p>It is a quiet night. You find a corner to meditate and listen to the local gossip.</p>
<</if>>
<<GenerateEncounterBatch "tavern">>
<<DisplayEncounter>>
<hr>
<<link "Rest at a table (Cost: 5 Spirit Stones)" $passage>>
<<set $gold -= 5>><<set $energy += 20>>
<</link>>
<br><<link "Leave the tavern" $city>><<set $pe to 0>><</link>>
<</if>><h1 style="text-align:center; color:#d4af37; border-bottom: 2px ridge #d4af37;">Celestial Alchemy Cauldron</h1>
<p class="flavor-text">A faint hum of spiritual energy emanates from the bronze tripod. Ancient runes glow along the walls as you prepare your ingredients.</p>
<div id="craftlog"></div>
<<if $knownRecipes.length gt 0>>
<<nobr>>
/* State Management */
<<set $workshopPage to $workshopPage ?? 1>>
<<set $workshopFilter to $workshopFilter ?? "All">>
<<set _itemsPerPage to 5>>
/* 1. Gather Tags for Filters */
<<set _availableTags to ["All"]>>
<<for _recipe range $knownRecipes>>
/* Using your new 'tag' variable from the potion object */
<<set _tag to _recipe.result.tag ?? "Misc">>
<<if not _availableTags.includes(_tag)>>
<<run _availableTags.push(_tag)>>
<</if>>
<</for>>
/* 2. Filter Logic */
<<set _filteredRecipes to []>>
<<for _recipe range $knownRecipes>>
<<if $workshopFilter eq "All" or _recipe.result.tag eq $workshopFilter>>
<<run _filteredRecipes.push(_recipe)>>
<</if>>
<</for>>
/* 3. Pagination Math */
<<set _maxPage to Math.max(1, Math.ceil(_filteredRecipes.length / _itemsPerPage))>>
<<set _startIndex to ($workshopPage - 1) * _itemsPerPage>>
<<set _displayRecipes to _filteredRecipes.slice(_startIndex, _startIndex + _itemsPerPage)>>
/* 4. Filter UI */
<div class="filter-bar">
<span style="color:#8b7332; margin-right:10px;">◈ Category ◈</span>
<<for _tag range _availableTags>>
<<capture _tag>>
<<if $workshopFilter eq _tag>>
<span class="filter-link active-filter">_tag</span>
<<else>>
/* Fixed passage error by using 'goto' inside link */
<<link _tag>>
<<set $workshopFilter to _tag>>
<<set $workshopPage to 1>>
<<goto `passage()`>>
<</link>>
<</if>>
<</capture>>
<</for>>
</div>
/* 5. The Table */
<table class="alchemy-table">
<tr>
<th>Pill Name</th>
<th>Required Essence</th>
<th>Action</th>
</tr>
<<if _displayRecipes.length eq 0>>
<tr><td colspan="3" style="text-align:center;">No scrolls found in this category.</td></tr>
<<else>>
<<for _recipe range _displayRecipes>>
<tr>
<td>
<span class="recipe-name"><<print _recipe.name>></span><br>
<span style="font-size: 0.85em; color: #aaa;"><i><<print _recipe.result.description>></i></span>
</td>
<td>
<<for _id, _qty range _recipe.ingredients>>
<<set _itemName to _id.replace(/([a-z])([A-Z])/g, "$1 $2").toUpperFirst()>>
<span class="ingredient-item" style="color:#a8d5a8;">
🌿 _qty x _itemName
</span><br>
<</for>>
</td>
<td style="text-align:center;">
<<link "Commence Refining">>
<<craftItem _recipe>>
<</link>>
</td>
</tr>
<</for>>
<</if>>
</table>
/* 6. Pagination Controls */
<div style="text-align: center; margin-top: 20px; font-family: serif;">
<<if $workshopPage gt 1>>
<<link "🠔 Previous Scroll">>
<<set $workshopPage -= 1>>
<<goto `passage()`>>
<</link>>
<<else>>
<span style="color: #444;">🠔 Previous Scroll</span>
<</if>>
<span style="margin: 0 20px; color:#d4af37;">Step _workshopPage of _maxPage</span>
<<if $workshopPage lt _maxPage>>
<<link "Next Scroll 🠖">>
<<set $workshopPage += 1>>
<<goto `passage()`>>
<</link>>
<<else>>
<span style="color: #444;">Next Scroll 🠖</span>
<</if>>
</div>
<</nobr>>
<<else>>
<p>Your mind is empty of pill formulas. Seek out alchemical manuals before returning to the cauldron.</p>
<</if>>
<br>
<div style="text-align:center;">
<<link "Leave the Cauldron Room" $passage>>
<<unset $workshopPage, $workshopFilter>>
<</link>>
</div>Image of portal >.<
<<link "Go back" $passage>><</link>>
You're currently at $region
From this place you can use portal to:
<<set _destinations = [
{name:"Ghost King Netherworld Sect", region:"Ghost King Netherworld Sect", passage:"GhostKingNetherworldSect", x:9, y:12},
{name:"Clear Sky Azure Dragon Pavilion", region:"Clear Sky Azure Dragon Pavilion", passage:"ClearSkyAzureDragonPavilion", x:1, y:6},
{name:"Jade Creek Town", region:"Jade Creek Town", passage:"Jade Creek Town", x:2, y:12}
]>>
<p>You stand before a glowing portal. Where will you go?</p>
<<nobr>>
<<for _d range _destinations>>
<<if $region !== _d.region>>
<<if $gold >= 25>>
<li>
<<capture _d>>
<<link "Teleport to ">>
<<set $gold -= 25>>
<<set $region = _d.region>>
<<set $playerX = _d.x>>
<<set $playerY = _d.y>>
<<goto _d.passage>>
<</link>> (Cost: 25 gold) _d.name
<</capture>>
</li>
<<else>>
<li><span style="opacity:0.5">Teleport to [_d.name] (Not enough gold!)</span></li>
<</if>>
<<else>>
<li><span style="opacity:0.5">Already at [_d.name]</span></li>
<</if>>
<</for>>
<</nobr>>[[Go back->ClearSkyAzureDragonPavilion]]
<div class="sect-info">
<h2>Clear Sky Azure Dragon Pavilion</h2>
<p><b>Sect Purpose:</b> Defending humanity from demonic beasts.</p>
<p><b>Sect Rules:</b> Do not harm the innocent.</p>
<hr>
<p><b>Your Position:</b></p>
<<if $CurrentPcMainSect != "Azure Dragon Sect" and $CurrentPcMainSect != "Ghost King Netherworld Sect">>
<<link "Join the Sect">>
<<goto "Clear Sky Azure Dragon Pavilion Joining Scene">>
<</link>>
<<elseif $CurrentPcMainSect neq "Azure Dragon Sect">>
<ul>
<li><b>You're not part of this sect!</b></li>
</ul>
<<elseif $CurrentPcMainSect == "Azure Dragon Sect">>
<ul>
<li><b>Rank:</b> <<print $CurrentPcSectRank>></li>
<li><b>Reputation:</b> <<print $CurrentPcSectReputation>></li>
</ul>
<</if>>
</div><<if $pe eq 0>>
<<set $returnpassage to passage()>>
<<if $recommendationLetter eq "righteous">>
Variant 1: Player has a recommendation letter
You stand at the entrance of the Clear Sky Azure Dragon Pavilion, the sacred grounds of the sect stretching out before you. The towering structures of ancient stone and wood stand with an aura of power and wisdom. The sound of distant cultivation practices echoes across the courtyard as disciples train and meditate, their movements graceful and precise.
You take a deep breath, clutching the sealed recommendation letter you received earlier. The sect’s disciple eyes the letter, and a respectful nod follows.
“I see you’ve been vouched for. The Pavilion welcomes you.”
With that, he gestures toward the main building, allowing you to pass.
You have been accepted into the sect, your future now intertwined with the Azure Dragon Pavilion.
You may now begin your training and cultivate under their guidance.
<<link "Continue" "ClearSkyAzureDragonPavilion">>
<<set $CurrentPcSectRank to "Initiate">>
<<set $CurrentPcAffiliation to "Clear Sky Azure Dragon Pavilion">>
<<set $CurrentPcMainSect to "Azure Dragon Sect">>
<<set $CurrentPcSect to "righteous">>
<</link>>
<<else>>
You stand at the entrance of the Clear Sky Azure Dragon Pavilion, the sacred grounds of the sect stretching out before you. The towering structures of ancient stone and wood stand with an aura of power and wisdom. The sound of distant cultivation practices echoes across the courtyard as disciples train and meditate, their movements graceful and precise.
You approach the entrance, heart racing with excitement at the thought of joining such a prestigious sect. A disciple standing guard raises an eyebrow, looking you over.
“Do you have a recommendation letter from a sect member or higher authority?” Without one, I’m afraid we cannot allow entry into the sect at this time. The path to true cultivation requires both merit and connections. However you may try to enter through duel trial. You'll face one of the sect initiates. If you manage to win, you'll be accepted”
With no recommendation in hand, you feel your chances slipping away. However, the sect is vast, and there may still be a way for you to prove yourself. The choice is yours—find another way to gain favor or try your luck elsewhere.
[[Try another time..->ClearSkyAzureDragonPavilion][$pe=0]]
[[Try through duels!->Clear Sky Azure Dragon Pavilion Joining Scene][$pe=2]]
<</if>>
<<elseif $pe eq 2>>
<<CreateNPC_Region1>>
You stand at the middle of stage, people are watching you.
You'll face _fullname
You can gauge their strength by observing their stance and aura. He is at _realm.
<<BeforeBattle>>
<<set $currentEnemy.sectNPC to "Clear Sky Azure Dragon Pavilion">>
<<link "Attack" "SectEntranceBattle1">><<set $pe to 0>>
<<set $passage to "SectEntranceBattle1">>
<</link>>
<<elseif $pe eq 3>>
<<if $health lte 0>>
Your legs give out as the final blow lands. The stage spins, and everything fades to white.
$currentEnemy.fullname stands tall, their breathing calm but sharp.
"You fought bravely... but you lack experience. Train harder, and perhaps fate will smile upon you next time."
The disciples around the stage whisper, some nodding in respect, others looking unimpressed.
<<link "Leave in shame!" "Map|Region1">><<set $pe to 0>><</link>>
<<elseif $currentEnemy.NPCcurrenthealth lte 0>>
With one final strike, your opponent stumbles backward, collapsing to the stage.
A hush falls over the crowd.
$currentEnemy.fullname grits their teeth. "You... you are strong. The elders were right to test you."
An elder descends from the pavilion steps, his long white beard fluttering in the breeze.
"You have proven your determination and strength through battle. The Clear Sky Azure Dragon Pavilion welcomes you."
<<link "Continue" "ClearSkyAzureDragonPavilion">>
<<set $pe = 0>>
<<set $CurrentPcSectRank to "Initiate">>
<<set $CurrentPcAffiliation to "Clear Sky Azure Dragon Pavilion">>
<<set $CurrentPcMainSect to "Azure Dragon Sect">>
<<set $CurrentPcSect to "righteous">>
<</link>>
<</if>>
<</if>><div style="text-align:center;">
<img src="images/Locations/clearskyazure.jpg" class="location-bg" style="width:80%; border: 1px solid #00ced1; box-shadow: 0 0 15px rgba(0, 206, 209, 0.3);">
<h2 class="town-title" style="color:#00ced1; text-shadow: 0 0 10px rgba(0, 206, 209, 0.5);">碧空青龙阁</h2>
<div style="font-size: 0.9em; color: #00ced1; margin-top:-5px;">— Clear Sky Azure Dragon Pavilion —</div>
</div>
<<nobr>>
<<set $passage to passage()>>
<p style="font-style:italic; color:#aaa; text-align:center; max-width:500px; margin: 10px auto;">
The gates of the sect loom before you — ancient, imposing, and pulsing faintly with qi.
Disciples in azure robes patrol the entrance, scrutinizing newcomers.
</p>
<div class="city-grid" style="border-color: #00ced1;">
/* Top Row: Information and Exit */
<<link '<span class="nav-card">📜 Sect Info</span>' "CSADP">><</link>>
<<link '<span class="nav-card exit-btn">⬅ Exit Gates</span>' "Map|Region1">><<set $pe to 0>><</link>>
/* Facility: Hospital */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled">Hospital (Locked)</span>
<<else>>
<<link '<span class="nav-card">🏥 Hospital</span>' "Hospital|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Portal (Usually open to all) */
<<link '<span class="nav-card">🌀 Spirit Portal</span>' "Portal|Stage 1">><<set $pe to 0>><</link>>
/* Facility: Manual Library */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled">Library (Locked)</span>
<<else>>
<<link '<span class="nav-card">📚 Manual Library</span>' "Manual Library|Stage 1">><<set $pe to 0>><<set $selectedFloor to "Initiate">><</link>>
<</if>>
/* Facility: Treasure Pavilion */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled">Treasury (Locked)</span>
<<else>>
<<link '<span class="nav-card">💎 Treasure Pavilion</span>' "Treasure Pavilion|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Mission Hall */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled">Missions (Locked)</span>
<<else>>
<<link '<span class="nav-card">⚔️ Mission Hall</span>' "Mission Hall|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Spirit Pavilion */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled">Spirit Pavilion (Locked)</span>
<<else>>
<<link '<span class="nav-card">✨ Spirit Pavilion</span>' "Spirit Pavilion|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Council Hall (Bottom Span) */
<<if $CurrentPcMainSect neq "Azure Dragon Sect">>
<span class="nav-card disabled" style="grid-column: span 2;">Council Hall (Elders Only)</span>
<<else>>
<<link '<span class="nav-card" style="grid-column: span 2;">🏛️ Council Hall</span>' "Council Hall|Stage 1">><<set $pe to 0>><</link>>
<</if>>
</div>
<<DisplayNPCS "sect" "Clear Sky Azure Dragon Pavilion">>
<</nobr>>[[Go back->GhostKingNetherworldSect]]
<div class="sect-info">
<h2>Ghost King Netherworld Sect</h2>
<p><b>Sect Purpose:</b> To dominate the mortal and spiritual realms.</p>
<p><b>Sect Rules:</b> Never betray the Sect.</p>
<hr>
<p><b>Your Position:</b></p>
<<if $CurrentPcMainSect != "Azure Dragon Sect" and $CurrentPcMainSect != "Ghost King Sect">>
<<link "Join the Sect">>
<<goto "GhostKingNetherworldSectJoiningScene">>
<</link>>
<<elseif $CurrentPcMainSect neq "Ghost King Sect">>
<ul>
<li><b>You're not part of this sect!</b></li>
</ul>
<<elseif $CurrentPcMainSect == "Ghost King Sect">>
<ul>
<li><b>Rank:</b> <<print $CurrentPcSectRank>></li>
<li><b>Reputation:</b> <<print $CurrentPcSectReputation>></li>
</ul>
<</if>>
</div><div style="text-align:center;">
<img src="images/Locations/ghostkingsect.jpg" class="location-bg" style="width:80%; border: 1px solid #9400d3;">
<h2 class="ghostly-title">幽冥鬼王宗</h2>
<div style="font-size: 0.8em; color: #9400d3; margin-top:-5px; letter-spacing: 2px;">— Ghost King Netherworld Sect —</div>
</div>
<<nobr>>
<<set $passage to passage()>>
<p style="font-style:italic; color:#888; text-align:center; max-width:500px; margin: 10px auto; font-size: 0.9em;">
The gates of the sect loom before you — ancient, imposing, and pulsing with a cold, spectral qi.
Disciples clad in dark, flowing robes watch your every move with hollow eyes.
</p>
<div class="city-grid ghostly-grid">
/* Top Row */
<<link '<span class="nav-card">💀 Sect Info</span>' "GKNS">><</link>>
<<link '<span class="nav-card exit-btn">⬅ Exit Gates</span>' "Map|Region1">><<set $pe to 0>><</link>>
/* Facility: Hospital (Currently non-functional based on your code) */
<span class="nav-card disabled">Hospital (Locked)</span>
/* Facility: Portal */
<<link '<span class="nav-card">🌀 Nether Portal</span>' "Portal|Stage 1">><<set $pe to 0>><</link>>
/* Facility: Manual Library */
<<if $CurrentPcMainSect neq "Ghost King Sect">>
<span class="nav-card disabled">Forbidden Library (Locked)</span>
<<else>>
<<link '<span class="nav-card">📜 Manual Library</span>' "Manual Library|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Treasure Pavilion */
<<if $CurrentPcMainSect neq "Ghost King Sect">>
<span class="nav-card disabled">Treasury (Locked)</span>
<<else>>
<<link '<span class="nav-card">💎 Treasure Pavilion</span>' "Treasure Pavilion|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Mission Hall */
<<if $CurrentPcMainSect neq "Ghost King Sect">>
<span class="nav-card disabled">Dark Missions (Locked)</span>
<<else>>
<<link '<span class="nav-card">⚔️ Mission Hall</span>' "Mission Hall|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Spirit Pavilion */
<<if $CurrentPcMainSect neq "Ghost King Sect">>
<span class="nav-card disabled">Spirit Pavilion (Locked)</span>
<<else>>
<<link '<span class="nav-card">✨ Spirit Pavilion</span>' "Spirit Pavilion|Stage 1">><<set $pe to 0>><</link>>
<</if>>
/* Facility: Council Hall */
<<if $CurrentPcMainSect neq "Ghost King Sect">>
<span class="nav-card disabled" style="grid-column: span 2;">Ghost King's Throne (Locked)</span>
<<else>>
<<link '<span class="nav-card" style="grid-column: span 2;">🏛️ Council Hall</span>' "Council Hall|Stage 1">><<set $pe to 0>><</link>>
<</if>>
</div>
<<DisplayNPCS "sect" "Ghost King Netherworld Sect">>
<</nobr>><<if $pe eq 0>>
<<set $returnpassage to passage()>>
<<if $recommendationLetter eq "evil">>
Variant 1: Player has a recommendation letter
You stand at the entrance of the Ghost King Netherworld Sect, the sacred grounds of the sect stretching out before you. The towering structures of ancient stone and wood stand with an aura of power and wisdom. The sound of distant cultivation practices echoes across the courtyard as disciples train and meditate, their movements graceful and precise.
You take a deep breath, clutching the sealed recommendation letter you received earlier. The sect’s disciple eyes the letter, and a respectful nod follows.
“I see you’ve been vouched for. The Pavilion welcomes you.”
With that, he gestures toward the main building, allowing you to pass.
You have been accepted into the sect, your future now intertwined with the Ghost King Netherworld Sect.
You may now begin your training and cultivate under their guidance.
<<link "Continue" "GhostKingNetherworldSect">>
<<set $CurrentPcSectRank to "Initiate">>
<<set $CurrentPcAffiliation to "Ghost King Netherworld Sect">>
<<set $CurrentPcMainSect to "Ghost King Sect">>
<<set $CurrentPcSect to "demonic">>
<</link>>
<<else>>
You stand at the entrance of the Ghost King Netherworld Sect, the sacred grounds of the sect stretching out before you. The towering structures of ancient stone and wood stand with an aura of power and wisdom. The sound of distant cultivation practices echoes across the courtyard as disciples train and meditate, their movements graceful and precise.
You approach the entrance, heart racing with excitement at the thought of joining such a prestigious sect. A disciple standing guard raises an eyebrow, looking you over.
“Do you have a recommendation letter from a sect member or higher authority?” Without one, I’m afraid we cannot allow entry into the sect at this time. The path to true cultivation requires both merit and connections. However you may try to enter through duel trial. You'll face one of the sect initiates. If you manage to win, you'll be accepted”
With no recommendation in hand, you feel your chances slipping away. However, the sect is vast, and there may still be a way for you to prove yourself. The choice is yours—find another way to gain favor or try your luck elsewhere.
[[Try another time..->GhostKingNetherworldSect][$pe=0]]
[[Try through duels!->GhostKingNetherworldSectJoiningScene][$pe=2]]
<</if>>
<<elseif $pe eq 2>>
<<CreateNPC_Region1>>
You stand at the middle of stage, people are watching you.
You'll face _fullname
You can gauge their strength by observing their stance and aura. He is at _realm.
<<BeforeBattle>>
<<set $currentEnemy.sectNPC to "Ghost King Netherworld Sect">>
<<link "Attack" "SectEntranceBattle1">><<set $pe to 0>>
<<set $passage to "SectEntranceBattle1">>
<</link>>
<<elseif $pe eq 3>>
<<if $health lte 0>>
Your legs give out as the final blow lands. The stage spins, and everything fades to white.
<<= $currentEnemy.fullname>> stands tall, their breathing calm but sharp.
"You fought bravely... but you lack experience. Train harder, and perhaps fate will smile upon you next time."
The disciples around the stage whisper, some nodding in respect, others looking unimpressed.
<<link "Leave in shame!" "Map|Region1">><<set $pe to 0>><</link>>
<<elseif $currentEnemy.NPCcurrenthealth lte 0>>
With one final strike, your opponent stumbles backward, collapsing to the stage.
A hush falls over the crowd.
<<= $currentEnemy.fullname>> grits their teeth. "You... you are strong. The elders were right to test you."
An elder descends from the pavilion steps, his long white beard fluttering in the breeze.
"You have proven your determination and strength through battle. The Ghost King Netherworld Sect welcomes you."
<<link "Continue" "GhostKingNetherworldSect">>
<<set $pe = 0>>
<<set $CurrentPcSect to "demonic">>
<<set $CurrentPcSectRank to "Initiate">>
<<set $CurrentPcAffiliation to "Ghost King Netherworld Sect">>
<<set $CurrentPcMainSect to "Ghost King Sect">>
<</link>>
<</if>>
<</if>><<if $pe eq 0>>
You are fighting $currentEnemy.fullname !
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
<b>General Actions</b>:
<<link "Attack" "SectEntranceBattle1">>
<<set $pe to 1>>
<<set $playeraction = "attack">>
<</link>>
<table class="abilities-table">\
<td>\
<b>Abilities</b>:
<<for _i to 0; _i lt $skillInventory.length; _i++>>\
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<<print $skillInventory[_i].name>> (Energy cost: $skillInventory[_i].energy )\
<<capture _i>>\
<<if $energy lt $skillInventory[_i].energy>><i>Not enough energy</i>
<<else>> <<link "Use" "SectEntranceBattle1">>
<<set $pe = 1>><<set $playeraction = "ability">> <<set $ability = $skillInventory[_i].widgetname>> <<set $abilityenergy = $skillInventory[_i].energy>><<set $energy -= $abilityenergy>> <<set $abilitylevel = $skillInventory[_i].level>> <</link>> <</if>>
<</capture>>\
<</if>>
<</for>>\
</td>\
</table>
<<if $activePassiveSkill != "">>
<<Ability $activePassiveWidget>><</Ability>>
<</if>>
<<EnemyBattleTable>>
<<elseif $pe eq 1>>
<<if $playeraction eq "attack">>You attempt to hit the $currentEnemy.fullname !
<<PlayerAttackAttempt>>
<<if $playeraction = "attack success">>
<<PlayerAttackDamage>>
<<elseif $playeraction eq "attack failure">>
You missed your attack!
<</if>><</if>>
<<EnemyStun>>
<<if $enemyaction eq "attack">>The $currentEnemy.fullname attacks you!
<<EnemyAttackAttempt>>
<<if $enemyaction = "attack success">>
<<EnemyAttackDamage>>
<<elseif $enemyaction eq "attack failure">>
The $currentEnemy.fullname missed their attack!
<</if>><</if>>
<<if $playeraction eq "ability">>
<<Ability $ability>><</Ability>><</if>>
<<if $currentEnemy.NPCcurrenthealth lte 0>>
<<link "The enemy is defeated! Victory!" $returnpassage>><<set $pe = 3>><</link>>
<<elseif $health lte 0>>
<<link "You've lost" $returnpassage>><<set $pe to 3>><</link>><
<<else>>
<<link "Continue battle" $passage>><<set $pe = 0>><</link>>
<</if>>
<</if>><<set $sectItems to []>><<widget "HuntBeastsR1">>
<<set _chance = random(0,100)>>
<<if _chance lte 20>>
<<BloodfangTiger>>
<<elseif _chance gt 20 and _chance lt 40>>
<<IronclawBear>>
<<else>>
<<ScarletEagle>>
<</if>>
<</widget>>
<<widget "BloodfangTiger">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Bloodfang Tiger">>
<<set _fullname = "Bloodfang Tiger">>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _maxhealthNPC = random(340, 450)>>
<<set _maxenergyNPC = random(120, 160)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 5)>>
<<set _insightNPC = random(1, 5)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(6, 17)>>
<<set _defNPC = random(9, 16)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(6, 13)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _enemyEXP = random (20,40)>>
<<set _spiritualRootNPC = random(0, 3)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _description = "You see Bloodfang Tiger, its crimson fur slick with dried blood. It growls lowly, its fangs pulsing with an ominous qi, thirsting for another soul.">>
<<set _npc = {
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP
}>>
<</silently>>\
<</widget>>\
<<widget "IronclawBear">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Ironclaw Bear">>
<<set _fullname = "Ironclaw Bear">>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _maxhealthNPC = random(340, 450)>>
<<set _maxenergyNPC = random(120, 160)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 5)>>
<<set _insightNPC = random(1, 5)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(6, 17)>>
<<set _defNPC = random(9, 16)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(6, 13)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _spiritualRootNPC = random(0, 3)>>
<<set _enemyEXP = random (20,40)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _description = "You see Ironclaw Bear, a hulking beast with claws like sabers. The earth trembles with each of its heavy, deliberate steps.">>
<<set _npc = {
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyXP: _enemyEXP,
enemyDesc: _description
}>>
<</silently>>\
<</widget>>\
<<widget "ScarletEagle">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Scarlet Eagle">>
<<set _fullname = "Scarlet Eagle">>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _maxhealthNPC = random(340, 450)>>
<<set _maxenergyNPC = random(120, 160)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 5)>>
<<set _insightNPC = random(1, 5)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(6, 17)>>
<<set _defNPC = random(9, 16)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(6, 13)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _spiritualRootNPC = random(0, 3)>>
<<set _enemyEXP = random (20,40)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _description = "You see Scarlet Eagle, circling above. Its cry echoes sharply across the valley as it dives with blinding speed.">>
<<set _npc = {
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyXP: _enemyEXP,
enemyDesc: _description
}>>
<</silently>>\
<</widget>>\
<<widget "WhisperingShade">>
<<silently>>
<<set _enemyability = []>>
<<set _enemyability.push("attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Whispering Shade">>
<<set _fullname = "Whispering Shade">>
<<set _location = ["Bamboo Grove of Whispers", "Forgotten Burial Ground", "Moonlit Ravine"].random()>>
<<set _maxhealthNPC = random(280, 360)>>
<<set _maxenergyNPC = random(160, 220)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(2, 6)>>
<<set _insightNPC = random(6, 10)>>
<<set _basestrengthNPC = random(3, 6)>>
<<set _basewillpowerNPC = random(8, 12)>>
<<set _atkNPC = random(5, 12)>>
<<set _defNPC = random(7, 12)>>
<<set _critNPC = random(3, 6)>>
<<set _critresNPC = random(2, 5)>>
<<set _agilityNPC = random(8, 14)>>
<<set _martialArtsNPC = random(0, 1)>>
<<set _spiritualRootNPC = random(2, 4)>> <!-- Ghostly affinity -->
<<set _enemyEXP = random(35, 55)>>
<<set _enemyEvadeScore = (_agilityNPC * 2.2) + (_insightNPC * 1.8) + (_luckNPC * 0.5)>>
<<set _description = "A ghostly cultivator manifests from the shadows, its form wavering like smoke in the moonlight. Hollow eyes burn faintly as the whispers in the bamboo rise to a maddening chorus.">>
<<set _npc = {
fullname: _fullname,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyXP: _enemyEXP,
enemyDesc: _description
}>>
<</silently>>
<</widget>>
<<widget "ShadowtailBeast">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Shadowtail Beast">>
<<set _fullname = "Shadowtail Beast">>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _maxhealthNPC = random(340, 450)>>
<<set _maxenergyNPC = random(120, 160)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 5)>>
<<set _insightNPC = random(1, 5)>>
<<set _basestrengthNPC = random(7, 10)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(6, 17)>>
<<set _defNPC = random(9, 16)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(6, 13)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _enemyEXP = random (20,40)>>
<<set _spiritualRootNPC = random(0, 3)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _description = "You see Shadowtail Beast, its sleek dark fur glistening with a faint glow. It growls lowly, its eyes glowing violet.">>
<<set _npc = {
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP
}>>
<</silently>>\
<</widget>>\
<<widget "ScaredMerchants">>\
<<silently>>\
<<set _enemyability = []>>
<<set _enemyability.push("attack", "attack")>>
<<set _enemyregion = "Enemy">>
<<set _enemyimage = "Panicked_band_of_merchants">>
<<set _fullname = "Panicked band of merchants">>
<<set _location = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _maxhealthNPC = random(240, 250)>>
<<set _maxenergyNPC = random(100, 130)>>
<<set _currenthealthNPC = _maxhealthNPC>>
<<set _currentenergyNPC = _maxenergyNPC>>
<<set _luckNPC = random(1, 5)>>
<<set _insightNPC = random(1, 5)>>
<<set _basestrengthNPC = random(5, 6)>>
<<set _basewillpowerNPC = random(4, 7)>>
<<set _atkNPC = random(4, 10)>>
<<set _defNPC = random(3, 6)>>
<<set _critNPC = random(2, 4)>>
<<set _critresNPC = random(0, 2)>>
<<set _agilityNPC = random(6, 13)>>
<<set _martialArtsNPC = random(0, 2)>>
<<set _enemyEXP = random (20,40)>>
<<set _spiritualRootNPC = random(0, 3)>>
<<set _enemyEvadeScore = (_agilityNPC * 2) + (_insightNPC * 1.5) + (_luckNPC * 0.5)>>
<<set _description = "You see a band of merchants, their faces grim and eyes alert. They carry heavy packs and weapons, clearly not here for leisure.">>
<<set _npc = {
fullname: _fullname,
NPCmaxlifespan: _maxlifespanNPC,
NPClifespan: __lifespanNPC,
NPCmaxhealth: _maxhealthNPC,
NPCmaxenergy: _maxenergyNPC,
NPCcurrenthealth: _currenthealthNPC,
NPCcurrentenergy: _currentenergyNPC,
NPCluck: _luckNPC,
NPCinsight: _insightNPC,
NPCbasestrength: _basestrengthNPC,
NPCbasewillpower: _basewillpowerNPC,
NPCatk: _atkNPC,
NPCdef: _defNPC,
NPCcrit: _critNPC,
NPCcritres: _critresNPC,
NPCagility: _agilityNPC,
NPCmartialArts: _martialArtsNPC,
NPCspiritualRoot: _spiritualRootNPC,
NPClocation: _location,
enemyregion: _enemyregion,
enemyimage: _enemyimage,
enemyEvade: _enemyEvadeScore,
enemyAbility: _enemyability,
enemyDesc: _description,
enemyXP: _enemyEXP
}>>
<</silently>>\
<</widget>>\<<HuntBeastsR1>>
_description
<<link "Run away before _fullname sees you!" "Map|Region1">> <</link>>
<<link "Fall back and try to hunt different beast" "HuntBeasts|Region1">> <</link>>
<<link "Battle" "HuntBeastsBattle|Region1">><<set $passage to "HuntBeastsBattle|Region1">><<BeforeBattle>><<set $pe=0>><</link>><<if !$visibleMissions or $visibleMissions.length == 0>>
<<refreshMissions>>
<</if>>
<table class="mission-table">
<tr>
<th>Mission</th>
<th>Description</th>
<th>Reward</th>
<th>Action</th>
</tr>
<<for _mission range $visibleMissions>>
<tr>
<td><<print _mission.name>></td>
<td><<print _mission.description>></td>
<td><<print _mission.reward>> spirit stones</td>
<td><<if $SideMissionStatus is null>><<capture _mission>>
<<link "Accept" "Bounty Board">>
<<set $MissionType to "side">>
<<set $activeSideMission to _mission>>
<<set $SideMissionStatus to "accepted">>
<<replace "#missionlog">>Accepted: <<= _mission.name>><</replace>><</link>><</capture>> <</if>>
</td>
</tr>
<</for>>
</table>
<div id="missionlog"></div>
<<if $activeSideMission neq null>>
Your current mission: $activeSideMission.name !
Do you want to abandon your mission? <<link "Yes" "Bounty Board">><<set $activeSideMission to null>><<set $SideMissionStatus to null>><</link>>
<</if>>
<<link "⟳ Refresh missions">><<refreshMissions>><<goto "Bounty Board">><</link>>
<<link "Go back" $passage>><</link>><<if $mainStageStarted eq "false">>
You cautiously approach the source of the light. As you draw near, you discover a small, swirling entrance-a shimmering portal, barely visible to the naked eye.
Before you can react, an unknown force grabs you, pulling you through the portal with overwhelming power!
<<timed 2s>>
You lose consciousness for a moment. When you open your eyes, you find yourself standing in a strange, hidden realm. Ancient runes glow faintly on the walls around you. You realize you might have stumbled upon a long-forgotten tomb of an ancient immortal.
<<linkappend "Continue">>
As you step into the ancient tomb, the air grows still. Dust floats in the golden light leaking from cracks in the ceiling.
The stone floor beneath your feet is covered with strange symbols - etched into the rock with a precision that defies time.
At the far end of the chamber lies a raised platform. An ornate coffin rests at its center, flanked by broken statues and faded murals of celestial battles.
The atmosphere is heavy with spiritual pressure, as if the air itself remembers the power once held here.
Suddenly, a faint blue mist rises from the coffin - gathering into a vague humanoid form hovering above it.
<span class="soul">"So... even now, fate finds a way to mock me..."</span>
You tense instinctively. The presence is powerful... but fractured.
<span class="player">"Who are you?"</span>
The mist wavers, flickering with ancient sorrow.
<span class="soul">"I was once called Yu Wei, of the Blazing Phoenix Sect...
But titles no longer matter. I am what remains - a dying will, drifting on borrowed time."</span>
He drifts closer, looking into your eyes.
<span class="soul">"You... are not ready. Your cultivation is but a candle in the storm.
Yet... I have no choice. The echoes of what I witnessed must be passed on... or forgotten forever."
</span>
You hesitate.<span class="player">"Why me?"</span>
<span class="soul">"Because no one else is here...""</span>
The air hums with resonance. The tomb grows dim.
<span class="soul">"Let me show you what lies beyond mortal comprehension...
A glimpse... of what once shook the heavens. A demon… born of primordial chaos. It struck without warning. Our sect… fell in a single day. My disciples... elders... all of them… gone. I was mortally wounded… and my loyal few cast a final spatial art, dragging my body here… beyond time."</span>
<<linkappend "The world shifts. Your mind is pulled into the immortal's final memory.">>
You stand at the edge of a vast battlefield, skies burning violet, stars collapsing above. Celestial cultivators soar across the sky, locked in brutal combat with a massive, ever-shifting being of smoke and darkness - a Chaos Demon
<img src="images/Story/ancientchaosdemon.png" width=70%>
You see a tower of light shatter. Sect crumble. Divine weapons twist into shadows.
<img src="images/Story/ancientdeath.png" width=70%>
<span class="soul">"I struck it down - or so I thought.
But chaos does not die… it only waits."</span>
<<linkappend "Return to the Tomb">>
The vision ends. You're back in the tomb. Yu Wei flickers violently.
<span class="soul">"It is returning. I can feel it… a stirring in the Lower Planes. You may not be the one to stop it… But perhaps, you’ll live long enough to warn the others."</span>
He drifts back toward the coffin.
<span class="soul">"Take what remains of my will. May it guide you… until your path diverges from mine."</span>
A glowing sigil appears in the air. It burns itself into your spirit.
As the light fades, the tomb begins to crumble and you're pushed out of this <<link "realm" "Map|Region1">><<set $mainStageStarted to "true">><<set $baseatk +=4>><<set $basedef +=4>><<set $baseagility +=4>><<set $baseluck +=4>><<set $baseinsight +=4>><</link>>
<</linkappend>>
<</linkappend>>
<</linkappend>>
<</timed>>
<</if>>
<<if $mainStageStarted eq "true" and $mainStage eq 0>>
<<if $pe eq 0>>
The trail of dead spiritual flora leads you to the base of a weeping willow, its leaves turned a bruised, sickly purple. There, sprawled among roots that seem to be drinking from his wounds, lies the man. His robes-once the proud white and teal of a minor sect-are shredded, soaked in a mixture of dark bile and oxygenated blood.
His condition is a nightmare of Qi Deviation. His skin ripples as if thousands of insects are crawling beneath the surface; his meridians are glowing with a jagged, unstable light that threatens to detonate his very dantian. In his death grip, he clutches a scroll that makes your skin crawl. It isn't made of bamboo or paper-it is the sallow, preserved skin of a human back, and the ink used to scribe the forbidden characters is still tacky, smelling of fresh iron and ancient rot.
<video src="images/Story/ancient_scroll.mp4" class="nsfw-glow" autoplay loop muted playsinline></video>
The man’s head snaps toward you. His eyes are gone-replaced by swirling vortices of chaotic smoke.
<span class="male">"The stars... they lied!"</span> he rasps, a spray of blood hitting the grass. <span class="male">"We broke the seal of the Hidden Plane thinking it was a treasury... but it was a feeding trough! I watched the Sect Leader... he didn't just die... he was folded! They unmade him like a piece of silk!"</span>
He thrusts the scroll toward you, his fingers snapping from the force of his tremors.
<span class="male">"Take it... hide it in the deepest abyss! The Essence Leech... it’s the only way we survived the first hour, by eating our own brothers' foundations... but the more you drink, the more They can see you from the Void! Don't look at it! DON'T-"</span>
He collapses into a fit of violent coughing, his life-force flickering like a candle in a gale. The scroll pulses against your palm, a rhythmic heartbeat that synchronized with your own.
<<link "Incinerate the scroll and comfort him" "MainMissionStart">><<set $pe to 1>><<set $mainStage0choice to "incinerate">><</link>>
<<link "Learn forbidden technique and leave him to his fate" "MainMissionStart">><<set $pe to 2>><<set $mainStage0choice to "learn">><</link>>
<<link "Learn forbidden technique and consume him" "MainMissionStart">><<set $pe to 3>><<set $mainStage0choice to "consume">><</link>>
<<elseif $pe eq 1>>
You look at the wretched man and the blasphemous leather in your hands. To keep this would be to invite the same madness that broke his soul. You channel your Qi-not to take, but to cleanse.
<span class="player">"Rest now. The cycle of reincarnation is wide, and this filth will not follow you into the next life."</span>
The man’s clouded eyes focus for a single, lucid second. He let out a breath that sounded like a sob. As you ignite your spiritual fire, the human-skin scroll shrieks-a literal, high-pitched scream of a thousand trapped souls being set free. The leather curls into white ash, and for a moment, the heavy, oppressive scent of rot is replaced by the smell of rain and ozone.
The cultivator’s body relaxes, the jagged violet glow in his veins fading into a peaceful grey. He dies not as a monster, but as a man. In the ashes of the scroll, a single crystalline seed remains-not of blood, but of pure, condensed Celestial Dew.
<span class="male">"Thank... you... sister..."</span> his final whisper carries on the wind.
<<link "Leave the area quickly" "Map|Region1">><<set $righteousreputation += 35>><<set $activeDaoImprint = $harmonizedessence>><<set $mainStage += 1>><</link>>
<<elseif $pe eq 2>>
You look at the dying man. He is already a ghost; his power is fleeting, but the knowledge on this skin is eternal. You unfurl the scroll. The blood-ink glows, reflecting in your pupils.
<span class="player">"Your sacrifice is noted, but your fear is a weakness I cannot afford. I will carry this burden so you don't have to."</span>
You memorize the twisting, agonizing characters of the Essence Leech. Each word feels like a cold needle stitching itself into your brain. You roll the leather back up and tuck it into your robes. The man reaches out, his fingers brushing your hem, begging for an end you do not give.
You turn your back on him. As you walk away, the sounds of his wet, rattling gasps follow you until the forest swallows them. You have the power, and more importantly, you have your secrets.
<<link "Leave the area quickly" "Map|Region1">><<set $demonicreputation += 10>><<set $activeDaoImprint = $devouringessence>><<set $mainStage += 1>><</link>>
<<elseif $pe eq 3>>
The air is thick with the scent of his failing life. To let it dissipate into the atmosphere is an insult to the heavens. You unfurl the human-skin scroll, and the characters immediately begin to crawl onto your skin like black leeches.
<span class="player">"Why let your cultivation return to the world when it can live on within me? Consider this your final contribution to a greater cause."</span>
You place your hand directly over the man’s shattering Dantian. You don't just learn the technique; you execute it.
<span class="male">"NO! PLEASE—AGHHH!"</span>
His scream is cut short as his body begins to collapse inward. You feel a rush of hot, violent energy surge up your arm—raw, unrefined Qi, flavored with his terror and his years of hard work. His skin turns to dry parchment, and his bones become brittle as glass. When you stand up, you feel a terrifying strength thrumming in your veins. Your shadow seems just a little darker than it was minutes ago.
<<link "Leave the area quickly" "Map|Region1">><<set $baseatk +=3>><<set $basedef +=3>><<set $baseagility +=3>><<set $baseluck +=3>><<set $baseinsight +=3>><<set $drainingActs += 1>><<set $forcedExtraction +=1>><<set $demonicreputation += 35>><<set $activeDaoImprint = $devouringessence>><<set $mainStage += 1>><<set $corruption += 15>><</link>>
<</if>>
<</if>><<set $mainStageStarted = "false">>
<<set $mainStage = 0>><<nobr>>
<<set $missionpassage to passage()>>
<!--Rogue Cultivator-->
<<if $activeSideMission.id eq "killRogueCultivator01">>
<<if $pe eq 0>>
The moment you step into the clearing, the atmosphere thickens with killing intent. A faint metallic scent lingers in the air—blood, fresh and unclean.
In the distance, a lone figure stands atop a jagged stone. His robes are tattered, eyes wild with madness. Blackened qi coils around him like serpents, writhing with instability.
His cultivation has clearly deviated from the righteous path. He has become a danger not only to others—but to himself.
As his gaze locks onto yours, a wicked grin spreads across his face.
<<CreateNPC_Region1>>
<<BeforeBattle>>
<<link "To battle!" "MissionBattle1">><<set $passage to "MissionBattle1">><<set $pe to 0>><<set $nextPe to 1>><</link>>
<<elseif $pe eq 1>>
The rogue cultivator staggers back, coughing blood. His corrupted qi twists violently before dispersing into nothingness.
He falls to his knees, eyes briefly clearing of madness. "Perhaps... I was not entirely wrong..." he whispers before collapsing.
You've finished mission!
<<set $passage to "Map|Region1">>
<<MissionFinish>>
<<elseif $pe eq 2>>
The rogue cultivator’s laughter echoes as your vision fades. His strikes were reckless but devastating.
When you awaken, you lie wounded at the edge of the forest, talismans burnt and pride fractured.
The threat still roams..
You have retreated, badly wounded.
<<set $passage to "Map|Region1">>
<<MissionFailed>>
<</if>>
<</if>>
<!--Find Herb-->
<<if $activeSideMission.id eq "findHerb01">>
<<if $pe eq 0>>
The mist clings to your robes as you step into a hidden valley where moonlight filters through jagged cliffs. The air smells faintly of dew and decay.
Somewhere in this eerie stillness lies the <b>Moonshade Lily</b>, a herb that only blooms when starlight aligns with certain celestial veins in the earth.
A faint glow dances between the rocks—just within reach.
Yet something breathes, slow and guttural, in the darkness behind you...
<<link "Reach for the flower carefully" $missionpassage>><<set $pe to 1>><<set $herbApproach to "stealth">><</link>>
<<link "Charge forward and grab it" $missionpassage>><<set $pe to 1>><<set $herbApproach to "brute">><</link>>
<<elseif $pe eq 1>>
<<if $herbApproach eq "stealth">>
<<if $agility >= 6>>
Your movements are fluid as drifting mist.
Whatever creature guarded this place never senses you. You pluck the <b>Moonshade Lily</b>, its petals cool and luminous against your palm.
You leave without a sound — and with your life.
<<MissionFinish>>
<<else>>
A dry twig snaps beneath your foot. The growl comes instantly — guttural, furious.
You snatch the herb and roll away as claws slash your arm.
Blood drips, but so does victory.
Mission complete, though your wound burns faintly with something venomous...
<<set $health to $health - $health*0.1>>
<<MissionFinish>>
<</if>>
<<elseif $herbApproach eq "brute">>
<<if $strength >= 10>>
With a shout, you surge forward, qi blazing.
A monstrous silhouette lunges from the dark — too slow.
One strike of your fist sends it crashing into the rocks. You seize the lily before the dust settles.
<<set $righteousreputation +=1>>
<<MissionFinish>>
<<else>>
The beast is faster than you expected. Its claws tear through your robe as you wrench the flower free.
You stumble out, breath ragged, the <b>Moonshade Lily</b> clutched in bloodied fingers.
The valley claims its toll.
<<set $health to $health - $health*0.2>>
<<MissionFailed>>
<</if>>
<</if>>
<</if>>
<</if>>
<!--Scrool Recovery-->
<<if $activeSideMission.id eq "recoverScroll01">>
<<if $pe eq 0>>
Mist hangs over the quiet riverbank. The water glows faintly blue beneath the moonlight.
Half-submerged among the reeds is a <b>jade scroll case</b>, pulsing faintly with sealing qi.
But something stirs below the surface — the ripples too deliberate, too alive.
<<link "Use a pole to fish it out" $missionpassage>><<set $pe = 1>><<set $scrollMethod = "tool">><</link>>
<<link "Wade into the water to retrieve it directly" $missionpassage>><<set $pe = 1>><<set $scrollMethod = "direct">><</link>>
<<elseif $pe eq 1>>
<<if $scrollMethod is "tool">>
The pole trembles in your hands as you snag the case.
A sudden tug — something beneath the water tries to claim it.
You pull back hard, splashing mud and spray, until the current stills.
You’ve got it.
<<MissionFinish>>
<</if>>
<<if $scrollMethod is "direct">>
<img src="images/Sex/wet.webp" width=80%>
The water grips you with icy fingers as you wade in.
Something brushes your thigh—slick, cold, almost curious.
You snatch the scroll and leap back to the shore, heart pounding, robes soaked and clinging.
<<MissionFinish>>
<</if>>
<</if>>
<</if>>
<!--slay Demonic Beast-->
<<if $activeSideMission.id eq "slayDemonicBeast01">>
<<if $pe eq 0>>
The old shrine lies in ruin.
Statues of forgotten gods crumble beneath black vines; cracked stone bleeds faint red light.
The air stinks of sulfur and death.
Then—a growl.
A creature crawls from the shadows, all bone and sinew, with burning eyes and qi that distorts the air itself.
This demonic beast feeds on sacred resentment, its every breath a curse.
<<link "Confront it head-on" $missionpassage>><<set $pe=1>><<set $approach="fight">><</link>>
<<link "Try to cleanse the shrine before engaging" $missionpassage>><<set $pe=1>><<set $approach="purify">><</link>>
<<elseif $pe eq 1>>
<<if $approach eq "fight">>
The clash is brutal. Each strike shatters rock and burns air.
In the end, you stand over its corpse, demonic ichor sizzling at your feet.
<<MissionFinish>>
<<elseif $approach eq "purify">>
You kneel before the shrine, channeling righteous qi.
The beast screams as the light tears through it—its corruption dissolving into ash.
The shrine’s cracked statues glow faintly, offering silent thanks.
<<set $righteousreputation += 1>>
<<MissionFinish>>
<</if>>
<</if>>
<</if>>
<!--hunt River Serpent-->
<<if $activeSideMission.id eq "huntRiverSerpent01">>
<<if $pe eq 0>>
The river runs red. Torn nets and shattered boats drift by like corpses.
Villagers whisper of a **River Serpent**—its scales shimmer like silver flame, its venom can boil flesh.
As you step to the edge, the current stirs... and the serpent rises, eyes gleaming with old hunger.
<<link "Strike as it surfaces" $missionpassage>> <<set $pe=1>> <<set $serpentAction="attack">> <</link>>
<<link "Wait patiently and bait it with qi" $missionpassage>> <<set $pe=1>><<set $serpentAction="lure">><</link>>
<<elseif $pe eq 1>>
<<if $serpentAction eq "attack">>
You leap before it can fully emerge. Qi flares, scales shatter, and water explodes in a geyser of blood.
You drag its corpse ashore, exhausted but victorious.
<<AddItemToInventory $riverpearlscale>>
<<MissionFinish>>
<<elseif $serpentAction eq "lure">>
You hold your breath, still as stone. When it nears, you strike the water with divine precision.
The beast writhes and retreats into the depths, leaving behind a shimmering scale—a token of grudging respect.
<<AddItemToInventory $serpentmarkscale>>
<<set $insight += 1>>
<<MissionFinish>>
<</if>>
<</if>>
<</if>>
<!--rescue Missing Disciple-->
<<if $activeSideMission.id eq "rescueMissingDisciple01">>
<<if $pe eq 0>>
Fog clings to the cliffs of **Hundred Sorrows Mountain**, damp and suffocating.
You hear faint cries echoing between stone and wind.
Torn talismans, a broken sword, blood on the path… and a weak voice calling from the depths of a cave.
Inside, a many-eyed beast crouches over a wounded disciple.
<<link "Charge in to fight the creature" $missionpassage>> <<set $pe=1>><<set $rescueMethod="fight">><</link>>
<<link "Use stealth to draw it away" $missionpassage>> <<set $pe=1>><<set $rescueMethod="lure">><</link>>
<<elseif $pe eq 1>>
<<if $rescueMethod eq "fight">>
You roar and strike. The creature’s limbs thrash; its eyes burst one by one under your blows.
The disciple trembles but lives. You carry them to safety.
Mission complete.
<<set $righteousreputation += 1>>
<<MissionFinish>>
<<elseif $rescueMethod eq "lure">>
You toss a stone, masking your qi. The beast follows the sound.
You slip in, grab the disciple, and flee before it returns.
Both of you live — but nightmares will remain.
<<set $baseinsight += 1>>
<<MissionFinish>>
<</if>>
<</if>>
<</if>>
<!--collect VenomSacs -->
<<if $activeSideMission.id eq "collectVenomSacs01">>
<<if $pe eq 0>>
The dense forest air is humid and stifling. Glowing mushrooms light your path through a tangle of vines and roots. Beneath your feet, faint skittering warns of nearby danger.
Soon, you hear it—the rhythmic clicking of pincers. Forest scorpions. Their stingers drip with glistening venom, potent enough to melt bone.
You steel yourself. Alchemists pay well for these sacs… but the price is always blood.
The forest is thick with buzzing and clicking sounds. You spot two groups of scorpions clustered near glowing mushrooms.
One group is larger but more aggressive; the other smaller and less active.
<<link "Go for the larger group for more venom" $missionpassage >><<set $pe to 1>><<set $scorpionGroup to "large">><</link>>
<<link "Choose the smaller group for safety" $missionpassage>><<set $pe to 1>><<set $scorpionGroup to "small">><</link>>
<<elseif $pe eq 1>>
<<if $scorpionGroup eq "large">>
The larger group yields plenty of venom sacs, but several scorpions sting you before you can retreat. You manage to escape, wounded but richer.
<<set $health to $health - $health*0.15>>
<<set $gold to $gold + random(50, 70)>>
<<MissionFinish>>
<</if>>
<<if $scorpionGroup eq "small">>
The smaller group is easier to handle. You collect fewer sacs, but return unscathed. The alchemists will pay, though less generously.
<<MissionFinish>>
<</if>>
<</if>>
<</if>>
<!--Other Side Missions-->
<<if $activeSideMission.id eq "sparringPartner01">>
<<JuniorSpar>>
<</if>>
<<if $activeSideMission.id eq "cleanCourtyard01">>
<<CleanCourtyard01>>
<</if>>
<<if $activeSideMission.id eq "assistAlchemy01">>
<<AssistAlchemy01>>
<</if>>
<<if $activeSideMission.id eq "patrolPerimeter01">>
<<PatrolPerimeter01>>
<</if>>
<<if $activeSideMission.id eq "deliverSupplies01">>
<<DeliverSupplies01>>
<</if>>
<<if $activeSideMission.id eq "tendBeasts01">>
<<TendBeasts01>>
<</if>>
<<if $activeSideMission.id eq "scripturePavilion01">>
<<ScripturePavilion01>>
<</if>>
<<if $activeSideMission.id eq "dormDisturbance01">>
<<DormDisturbance01>>
<</if>>
<</nobr>><<set $activeSideMission to null>>
<<set $SideMissionStatus to null>>
<!--------------------------------------TOWN SIDE MISSIONS------------------------------>
<<set $sidemissions = [
{
"name": "Kill the rogue cultivator",
"reward": random(270, 350),
"description": "Find and eliminate the threat.",
"gainFame": random(1, 10),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "killRogueCultivator01"
},
{
"name": "Find the herb",
"reward": random(200, 300),
"description": "Retrieve the rare herb from the location.",
"gainFame": random(1, 5),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "findHerb01"
},
{
"name": "Recover lost scroll",
"reward": random(180, 250),
"description": "A disciple lost an important scroll near the river bend. Retrieve it.",
"gainFame": random(1, 4),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "recoverScroll01"
},
{
"name": "Slay the demonic beast",
"reward": random(350, 450),
"description": "A powerful beast has emerged near the old shrine. Eliminate it before it spreads chaos.",
"gainFame": random(5, 10),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "slayDemonicBeast01"
},
{
"name": "Hunt the river serpent",
"reward": random(350, 500),
"description": "A great serpent is terrorizing riverside villages. Slay it.",
"gainFame": random(4, 10),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "huntRiverSerpent01"
},
{
"name": "Rescue the missing disciple",
"reward": random(280, 360),
"description": "A disciple has gone missing near the Hundred Sorrows Mountain. Find and return them.",
"gainFame": random(2, 8),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "rescueMissingDisciple01"
},
{
"name": "Collect venom sacs",
"reward": random(220, 300),
"description": "Harvest venom sacs from forest scorpions for an alchemist.",
"gainFame": random(1, 5),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"id": "collectVenomSacs01"
}
]>>
<!--------------------------------------SECT SIDE MISSIONS-------------------------------->
<<set $SectSideMissions to []>>
<<set $SectSideMissions = [
{
"name": "Clean the Sect Courtyard",
"reward": random(3, 6),
"favor": 1,
"description": "Sweep the training ground and remove leftover debris after a sparring session.",
"gainFame": random(0, 2),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Initiate",
"id": "cleanCourtyard01"
},
{
"name": "Deliver Supplies to Outer Disciples",
"reward": random(4, 7),
"favor": 1,
"description": "Carry medicine and spirit water to the outer disciple quarters.",
"gainFame": random(1, 3),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Initiate",
"id": "deliverSupplies01"
},
{
"name": "Assist the Alchemy Hall",
"reward": random(5, 9),
"favor": 3,
"description": "Help sort herbs and clean the cauldrons for the alchemists.",
"gainFame": random(1, 4),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Initiate",
"id": "assistAlchemy01"
},
{
"name": "Patrol the Sect Perimeter",
"reward": random(6, 10),
"favor": 6,
"description": "Join a patrol squad to monitor the perimeter for intruders or demonic beasts.",
"gainFame": random(2, 5),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Disciple",
"id": "patrolPerimeter01"
},
{
"name": "Sparring Partner for Junior Disciples",
"reward": random(4, 8),
"favor": 3,
"description": "Help younger disciples improve by acting as their sparring partner in basic techniques.",
"gainFame": random(1, 4),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Disciple",
"id": "sparringPartner01"
},
{
"name": "Tend to the Spirit Beast Pens",
"reward": random(5, 9),
"favor": 2,
"description": "Feed the Elder's Spirit Cranes and clean their enclosures.",
"gainFame": random(0, 2),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Initiate",
"id": "tendBeasts01",
"twistEvent": "beastHeat" /*/ Chance a beast is in heat, making them aggressive or requiring special "soothing" herbs./*/
},
{
"name": "Organize the Scripture Pavilion",
"reward": random(6, 10),
"favor": 4,
"description": "Sort returned jade slips and dust the ancient bamboo scrolls.",
"gainFame": random(1, 3),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Initiate",
"id": "scripturePavilion01",
},
{
"name": "Investigate Dormitory Disturbance",
"reward": random(8, 12),
"favor": 6,
"description": "An Elder has complained of strange noises from the Outer Disciple dorms at night.",
"gainFame": random(3, 6),
"missionCordX": random(0, 11),
"missionCordY": random(2, 13),
"status": "available",
"region": "Region1",
"requiredRank": "Disciple",
"id": "dormDisturbance01",
"twistEvent": "secretLovers" /*/ NSFW Twist: Catch two disciples secretly practicing dual cultivation. Player can blackmail, report, or join them./*/
}
]>><div id="casualSexContainer">
<<CasualSex "the shady merchant" "a high-grade recovery potion" "sub" "vaginal" "Tournament|Region1">>
</div>
<<set $health = $maxhealth>><<nobr>>
/* Cap health at max */
<<if $health gte $maxhealth>><<set $health to $maxhealth>><</if>>
/* Shared arena image */
<div style="text-align: center; margin-top: 15px; border-top: 1px solid #444; padding-top: 10px;">
<span style="font-size: 0.9em; letter-spacing: 2px; color: #aaa;">CURRENT BRACKET</span><br>
<span style="font-size: 1.5em; font-weight: bold; color: #daa520;">
<<if $pe eq 0>>PRELIMINARY STAGE
<<elseif $pe eq 2>>ROUND OF 16
<<elseif $pe eq 3>>QUARTER-FINALS (TOP 8)
<<elseif $pe eq 4>>SEMI-FINALS (TOP 4)
<<elseif $pe eq 5>>CHAMPIONSHIP MATCH
<</if>>
</span>
</div>
<br><img src="images/Story/arena.png" class="center" width="600">
<<if $pe eq 0>> /* Preliminary Round */
<br><p>The air crackles with anticipation as the preliminary battles begin. Cultivators from all regions have gathered, their eyes sharp and spirits high. This is your chance to prove your worth and claim your place among the chosen sixteen.</p>
<p>Only the strong — or the cunning — will move forward. Step into the ring and let your strength speak for itself.</p>
<<set $actionsLeft to 3>>
/* ENHANCEMENT: Force Prelim enemies to be lower tier */
<<set _targetRealm to "Body Tempering Realm">>
<<set _targetStage to ["Early", "Middle", "Late"].random()>>
<<CreateNPC001>>
<br><p>As you check the match roster, your next opponent is revealed: <b>_fullname</b>. The name is unfamiliar — another ambitious cultivator seeking glory on the grand stage.</p>
<p>The crowd murmurs in anticipation, and the arena begins to hum with spiritual energy.</p>
<<BeforeBattle>>
<<link "Get ready and get on stage" "TournamentBattle|Region1">>
<<set $passage to "TournamentBattle|Region1">>
<<set $pe to 0>>
<<set $nextPe to $pe + 1>>
<</link>>
<<link "Forfeit!" $passage>><<set $nextPe to 1>><<set $roundLost to "Preliminary">><</link>>
<<elseif $pe eq 1>> /* Advanced to Top 16 */
<p>Your opponent lies defeated, and the crowd erupts into murmurs of awe. You’ve proven your strength, if only just. A jade slip confirms your advancement — you are among the final sixteen.</p>
<p>From now on, each battle will be one-on-one. Each loss, final. The real test begins.</p>
<<link "Continue!" "Tournament|Region1">>
<<set $pe to 2>>
<<set $roundLost to "Top 16">>
<</link>>
<<elseif $pe >= 2 and $pe <= 5>> /* Main Tournament Rounds (Top 16 → Top 2) */
/* ENHANCEMENT: Added targeted Realms and Stages to your array */
<<nobr>>
/***** 1. Get Player Indices (SAFE) *****/
<<set _pRealmIdx to $cultivationRealms.indexOf($cultivationRealm)>>
<<set _pStageIdx to $cultivationStages.indexOf($cultivationStage)>>
<<if _pRealmIdx < 0>><<set _pRealmIdx = 0>><</if>>
<<if _pStageIdx < 0>><<set _pStageIdx = 0>><</if>>
<<set _maxRealmIdx = $cultivationRealms.length - 1>>
/***** 2. Rolls *****/
<<set _rollRealm to random(1,100)>>
<<set _rollStage to random(1,100)>>
<<set _finalRoll to random(1,100)>>
/***** 3. Default shifts *****/
<<set _realmShift = 0>>
<<set _stageShift = 0>>
/***** 4. ROUND LOGIC *****/
<<if $pe is 2>> /* ===== TOP 16 ===== */
<<if _rollRealm lte 60>>
<<set _realmShift = 0>>
<<elseif _rollRealm lte 85>>
<<set _realmShift = -1>>
<<else>>
<<set _realmShift = 1>>
<</if>>
<<if _rollStage lte 50>>
<<set _stageShift = 0>>
<<elseif _rollStage lte 80>>
<<set _stageShift = -1>>
<<else>>
<<set _stageShift = 1>>
<</if>>
<<elseif $pe is 3>> /* ===== TOP 8 ===== */
<<if _rollRealm lte 70>>
<<set _realmShift = 0>>
<<else>>
<<set _realmShift = 1>>
<</if>>
<<if _rollStage lte 50>>
<<set _stageShift = 1>>
<<else>>
<<set _stageShift = 0>>
<</if>>
<<elseif $pe is 4>> /* ===== TOP 4 ===== */
<<set _realmShift = 0>>
<<set _stageShift = 1>>
<<elseif $pe is 5>> /* ===== FINALS ===== */
<<set _isLateStage to _pStageIdx === 2>>
<<set _canAdvanceRealm to _pRealmIdx < _maxRealmIdx>>
<<if _isLateStage and _canAdvanceRealm and _finalRoll lte 50>>
<<set _realmShift = 1>>
<<set _stageShift = 0>>
<<else>>
<<set _realmShift = 0>>
<<set _stageShift = 1>>
<</if>>
<</if>>
/***** 5. APPLY CLAMP *****/
<<set _enemyRealmIdx = Math.max(0, Math.min(_maxRealmIdx, _pRealmIdx + _realmShift))>>
<<set _enemyStageIdx = Math.max(0, Math.min(2, _pStageIdx + _stageShift))>>
/***** 6. FINALS ADJUSTMENT *****/
<<if $pe is 5>>
<<if _enemyRealmIdx > _pRealmIdx>>
<<set _enemyStageIdx = 0>> /* Early next realm */
<<else>>
<<set _enemyStageIdx = 2>> /* Late same realm */
<</if>>
<</if>>
/***** 7. BUILD ROUND DATA *****/
<<set _roundData = {
pe: $pe,
next: $pe + 1,
lost: (
$pe is 2 ? "Top16" :
$pe is 3 ? "Top8" :
$pe is 4 ? "Top4" :
"Top2"
),
nextFame: (
$pe is 2 ? 10 :
$pe is 3 ? 15 :
$pe is 4 ? 20 :
35
),
realm: $cultivationRealms[_enemyRealmIdx],
stage: $cultivationStages[_enemyStageIdx]
}>>
/***** 8. SAFETY FALLBACK *****/
<<if not _roundData.realm or not _roundData.stage>>
<<set _roundData.realm = $cultivationRealm>>
<<set _roundData.stage = $cultivationStage>>
<</if>>
/* 3. Apply the results to the NPC Generator */
<<if _roundData>>
<<set _targetRealm to _roundData.realm>>
<<set _targetStage to _roundData.stage>>
<<set $roundLost to _roundData.lost>>
<<set $nextPe to _roundData.next>>
/* Call the widget to build the opponent */
<<CreateNPC001>>
/* Optional: Buff the Finalist's stats if it's the Top 2 */
<<if $pe eq 5>>
<<set _npc.NPCmaxhealth *= 1.2>>
<<set _npc.NPCatk *= 1.1>>
<<set _npc.isBoss to true>>
<</if>>
<</if>>
<</nobr>>
<p>You <<if $actionsLeft lte 0>>don't<</if>> have time before your next match...</p>
<<if $actionsLeft gt 0>>
<<link "Rest" "Tournament|Region1">>
<<set $health to Math.min($health + 0.3 * $maxhealth, $maxhealth)>>
<<set $actionsLeft -= 1>>
<</link>>
<</if>>
/* Pass the targeted realm/stage to your generator */
<<set $targetRealm to _roundData.realm>>
<<set $targetStage to _roundData.stage>>
<<CreateNPC001>>
<<set $nextPe to _roundData.next>>
<<set $roundLost to _roundData.lost>>
<<BeforeBattle>>
<br><<link "Get ready and get on stage" "TournamentBattle|Region1">>
<<set $passage to "TournamentBattle|Region1">>
<<set $pe to 0>>
<<set $actionsLeft to 3>>
<<set $combatFame += _roundData.nextFame>>
<<set $fame += _roundData.nextFame>>
<</link>>
<br><<linkappend "Observe other battles">>
<<set _watchfight to random(1,3)>>
<<if _watchfight eq 1>>
<p>Two unfamiliar cultivators clash in a blur of movement. One conjures spears of flame, the other counters with a spinning jade barrier. In moments, the match ends — a clean strike to the chest, a cloud of dust, and silence.</p>
<<elseif _watchfight eq 2>>
<p>You watch as a towering man swings a massive blade, each strike causing tremors. His opponent dances like a shadow, evading each blow — until one misstep seals their fate. The match is over in an instant.</p>
<<else>>
<p>Two elegant female cultivators duel mid-air. Petals and frost swirl around them as techniques collide. One miscalculates her descent, crashing into the stone — and the battle ends with a respectful bow.</p>
<</if>>
<</linkappend>>
<<if $actionsLeft gt 0 and $health lt $maxhealth>>
<br><<linkappend "Buy recovery potion">>
<p>You stagger slightly as you return to the waiting area. Your body aches, blood still trickling from wounds earned in the last fight.</p>
<p>A shady vendor with a crooked smile eyes you knowingly. His stall is cluttered with glowing vials.</p>
<span class="male">“You look like hell warmed over. Lucky for you, I sell miracles in bottles.”</span>
He uncorks a flask — sweet, sharp qi wafts toward you.
<span class="male">“350 gold. It'll patch you up before the next round. Interested?”</span>
<<if $gold gte 350>>
<<linkappend "Buy healing potion">>
<<set $health to $maxhealth>>
<<set $energy to $maxenergy>>
<<set $gold -= 350>>
<p>You slap the coins into his palm. He grins and hands over the vial.</p>
<p><span class="male">“Pleasure doing business.”</span></p>
<p>You down the potion in one go. Warmth floods your limbs, wounds knitting closed. Strength returns.</p>
<</linkappend>>
<<else>>
<p>Your coin pouch is nearly empty.</p>
<p>The shopkeeper hums, amused. <span class="male">“No gold? Then maybe you'd be willing to... negotiate.”</span></p>
<p>He steps closer, eyes roaming shamelessly. <span class="male">“My potions are potent — surely worth a few moans?”</span></p>
<<if $corruption gte 20>>
<<link "Give in to his offer" "Tournament|MerchantSex">>
<<set $sexCumcount to 0, $sexPosition to "", $sexFinished to false>>
<<set $tournamentpassage to passage()>>
<<set $scene to 0>>
<</link>>
<</if>>
<<linkappend "Refuse and fight injured">>
<p>You shake your head. You’ll face the next battle bloodied but unbroken.</p>
<p>The shopkeeper shrugs. <span class="male">“Suit yourself. Just don’t die out there. I hate cleaning up corpses.”</span></p>
<</linkappend>>
<</if>>
<</linkappend>>
<</if>>
<<elseif $pe eq 6>> /* Victory! */
<br><p>The crowd explodes in a deafening roar as your final opponent crashes to the ground. You stand victorious, bloodied but unbowed, amidst the shattered battlefield.</p>
<p>You have done it. You are the champion of the Regional Tournament.</p>
<p>Your name will echo through the Jianghu for years to come.</p>
<<link "Return to the city in triumph" $city>>
<<set $combatFame += 35>>
<<set $fame += 35>>
<<set $gold += 450>>
<</link>>
<<elseif $pe is "lost">> /* Defeat Screen */
<<switch $roundLost>>
<<case "Preliminary">>
<p>You fall to your knees as pain courses through your body. The world fades in and out. You’ve failed to qualify — for now.</p>
<p>But even in defeat, a cultivator learns. You leave the stage, vowing to return stronger.</p>
<<set $combatFame += 2, $fame += 2>>
<<case "Top16">>
<p>You gave everything, but it wasn’t enough. Your opponent bows in respect, and you return the gesture through gritted teeth.</p>
<p>Defeat stings, but your journey continues.</p>
<<set $combatFame += 4, $fame += 4>>
<<case "Top8">>
<p>This far and no further. You have earned recognition and respect among the crowd.</p>
<p>Perhaps next time, your name will reach the heavens.</p>
<<set $combatFame += 6, $fame += 6>>
<<case "Top4">>
<p>So close. You almost tasted the summit. Your opponent offers a respectful nod.</p>
<p>The heavens favor the bold — and your boldness brought you to the edge.</p>
<<set $combatFame += 8, $fame += 8>>
<<case "Top2">>
<p>Your vision blurs as the final blow lands. You reached the summit — and fell just short.</p>
<p>This is not the end. The dao is long, and you are far from finished.</p>
<<set $combatFame += 15, $fame += 15>>
<</switch>>
<<link "Return to the city" $city>><</link>>
<</if>>
<</nobr>><div class="battle-container">
<<if $pe eq 0>>
/* --- 1. INITIATIVE & AMBUSH (Round 1 Only) --- */
<<if ndef $battleRound>>
<<set $battleRound = 1>>
<<set _playerSpeed = $agility + Math.floor($luck / 5) + random(1, 100)>>
<<set _enemySpeed = ($currentEnemy.agility || 100) + random(1, 100)>>
<<if _enemySpeed > _playerSpeed>>
<div class="combat-log-panel ambush-alert">
<h3 class="log-title">⚠️ Ambushed!</h3>
<div class="log-entry">
<i>$currentEnemy.fullname strikes before you can react!</i>
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">You narrowly evaded!</span><</if>>
</div>
</div>
<<if $health lte 0>><<link "Fall in Battle..." $returnpassage>><<set $playerLost to true>><<unset $battleRound>><</link>><</if>>
<<else>>
<div class="combat-log-panel initiative-alert">
<h3 class="log-title">⚡ Initiative Seized</h3>
<div class="log-entry"><i>Your agility grants you the first strike!</i></div>
</div>
<</if>>
<</if>>
<div class="enemy-presentation">
<h2 class="combat-title">Facing: $currentEnemy.fullname</h2>
<div class="enemy-portrait-frame">
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
</div>
<div class="enemy-stats-wrapper">
<<EnemyBattleTable>>
</div>
</div>
<<if $activePassiveSkill != "">>
<div class="passive-notification-box">
<span class="buff-icon">🌀</span> <<Ability $activePassiveWidget>><</Ability>>
</div>
<</if>>
<div class="combat-actions-panel">
<div class="action-column">
<h3>Martial Stance</h3>
<div class="action-button-container">
<<link "BASIC STRIKE" "Battle">>
<<set $pe to 1>><<set $playeraction = "attack">>
<</link>>
</div>
</div>
<div class="action-column">
<h3>Divine Abilities</h3>
<div class="ability-list">
<<for _i to 0; _i lt $skillInventory.length; _i++>>
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<div class="ability-row">
<div class="ability-info">
<span class="ability-name"><<print $skillInventory[_i].name>></span><br>
<span class="ability-cost">Qi: $skillInventory[_i].energy</span>
</div>
<div class="ability-action">
<<capture _i>>
<<if $energy lt $skillInventory[_i].energy>>
<span class="not-enough-qi">Low Qi</span>
<<else>>
<div class="invoke-button-container">
<<link "INVOKE" "Battle">>
<<set $pe = 1>><<set $playeraction = "ability">>
<<set $ability = $skillInventory[_i].widgetname>>
<<set $abilityenergy = $skillInventory[_i].energy>>
<<set $energy -= $abilityenergy>>
<<set $abilitylevel = $skillInventory[_i].level>>
<</link>>
</div>
<</if>>
<</capture>>
</div>
</div>
<</if>>
<</for>>
</div>
</div>
</div>
<<elseif $pe eq 1>>
<div class="combat-log-panel">
<h3 class="log-title">The Exchange</h3>
<div class="log-entry player-turn">
<<if $playeraction eq "attack">>
<b>You</b> attack $currentEnemy.fullname!
<<PlayerAttackAttempt>>
<<if $playeraction eq "attack success">><<PlayerAttackDamage>>
<<else>><span class="miss-text">Your strike missed!</span><</if>>
<<elseif $playeraction eq "ability">>
<div class="ability-execution-style">
<<Ability $ability>><</Ability>>
</div>
<</if>>
</div>
<hr class="combat-divider">
<div class="log-entry enemy-turn">
<<EnemyStun>>
<<if $enemyaction eq "attack">>
<b>$currentEnemy.fullname</b> retaliates!
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">The enemy missed!</span><</if>>
<</if>>
</div>
<div class="battle-resolution">
<<if $currentEnemy.NPCcurrenthealth lte 0>>
<<link "Victory! Enemy Slain" $returnpassage>>
<<set $battleWon = true>><<set $defeatedEnemy to $currentEnemy>>
<<set $pe = $nextPe>><<unset $battleRound>>
<</link>>
<<elseif $health lte 0>>
<<link "You have been defeated..." $returnpassage>>
<<set $playerLost to true>><<set $pe to $nextPe += 1>>
<<unset $battleRound>>
<</link>>
<<else>>
/* Force return to 'Battle' passage explicitly */
<<link "Continue the Clash" "Battle">>
<<set $pe = 0>><<set $battleRound++>>
<</link>>
<</if>>
</div>
</div>
<</if>>
</div><<if $pe eq 0>>
You are fighting $currentEnemy.fullname !
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
<b>General Actions</b>:
<<link "Attack" "Battle1">>
<<set $pe to 1>>
<<set $playeraction = "attack">>
<</link>>
<table class="abilities-table">\
<td>\
<b>Abilities</b>:
<<for _i to 0; _i lt $skillInventory.length; _i++>>\
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<<print $skillInventory[_i].name>> (Energy cost: $skillInventory[_i].energy )\
<<capture _i>>\
<<if $energy lt $skillInventory[_i].energy>><i>Not enough energy</i>
<<else>> <<link "Use" "Battle1">>
<<set $pe = 1>><<set $playeraction = "ability">> <<set $ability = $skillInventory[_i].widgetname>> <<set $abilityenergy = $skillInventory[_i].energy>><<set $energy -= $abilityenergy>> <<set $abilitylevel = $skillInventory[_i].level>> <</link>> <</if>>
<</capture>>\
<</if>>
<</for>>\
</td>\
</table>
<<if $activePassiveSkill != "">>
<<Ability $activePassiveWidget>><</Ability>>
<</if>>
<<EnemyBattleTable>>
<<elseif $pe eq 1>>
<<if $playeraction eq "attack">>You attempt to hit the $currentEnemy.fullname !
<<PlayerAttackAttempt>>
<<if $playeraction = "attack success">>
<<PlayerAttackDamage>>
<<elseif $playeraction eq "attack failure">>
You missed your attack!
<</if>><</if>>
<<EnemyStun>>
<<if $enemyaction eq "attack">>The $currentEnemy.fullname attacks you!
<<EnemyAttackAttempt>>
<<if $enemyaction = "attack success">>
<<EnemyAttackDamage>>
<<elseif $enemyaction eq "attack failure">>
The $currentEnemy.fullname missed their attack!
<</if>><</if>>
<<if $playeraction eq "ability">>
<<Ability $ability>><</Ability>><</if>>
<<if $currentEnemy.NPCcurrenthealth lte 0>> <<link "The enemy is slain! Victory!" $returnpassage>><<set $pe = $nextPe>><</link>>
<<elseif $health lte 0>><<link "You've lost!" $returnpassage>> <<set $pe to $nextPe += 1>> <</link>>
<<else>><<link "Continue battle" $passage>><<set $pe = 0>> <</link>>
<</if>>
<</if>><<set _deathChance to 0>>
<<set _pe to 0>>
<img src="images/Story/death.png" width=70%><<nobr>>
<<if $playerSect == "demonic" and $enemySect == "righteous">>
<<set _deathChance += 30>>
<</if>>
<<if $playerSect == "righteous" and $enemySect == "demonic">>
<<set _deathChance += 30>>
<</if>>
<<if $totalPCdemonicreputation > $totalPCrighteousreputation>>
<<set _deathChance += 20>>
<</if>>
<<if $totalPCrighteousreputation > $totalPCdemonicreputation>>
<<set _deathChance += 10>>
<</if>>
<<set _deathRoll to random(1,100)>>
<<if _deathRoll <= _deathChance>>
<p>Your opponent stands over your fallen body, victory burning in their eyes.</p>
<<if $enemySect == "righteous">>
<p>“For the greater good,” they mutter, raising their blade. The pain is brief… then, silence.</p>
<</if>>
<<if $enemySect == "demonic">>
<p>They sneer. “Too weak to live.” The world fades with their laughter echoing in your ears.</p>
<</if>>
<p>But fate is not so simple. As your soul slips from your body, something stirs — a pull, a fracture in time, a second chance.</p>
<<set $regression += 1>>
<<set $hasRegressed = true>>
<p>You awaken with a gasp, cold sweat clinging to your skin. You’re… alive. But weaker. Back to the moment before it all went wrong.</p>
<<link "..............." $returnpassage>> <<set $regression += 1>>
<<set $hasRegressed = true>><</link>>
<<else>>
<p>You were defeated, but your opponent spares you — for now. You live, but only barely.</p>
<<link "Go away" $returnpassage>><<set $health to 1>><<set $playerEnergy to 0>><</link>><</if>>
<</nobr>><<if $pe eq 0>>
You are fighting $currentEnemy.fullname !
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
<b>General Actions</b>:
<<link "Attack" "HuntBeastsBattle|Region1">>
<<set $pe to 1>>
<<set $playeraction = "attack">>
<</link>>
<table class="abilities-table">\
<td>\
<b>Abilities</b>:
<<for _i to 0; _i lt $skillInventory.length; _i++>>\
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<<print $skillInventory[_i].name>> (Energy cost: $skillInventory[_i].energy )\
<<capture _i>>\
<<if $energy lt $skillInventory[_i].energy>><i>Not enough energy</i>
<<else>> <<link "Use" "HuntBeastsBattle|Region1">>
<<set $pe = 1>><<set $playeraction = "ability">> <<set $ability = $skillInventory[_i].widgetname>> <<set $abilityenergy = $skillInventory[_i].energy>><<set $energy -= $abilityenergy>> <<set $abilitylevel = $skillInventory[_i].level>> <</link>> <</if>>
<</capture>>\
<</if>>
<</for>>\
</td>
</table>
<<if $activePassiveSkill != "">>
<<Ability $activePassiveWidget>><</Ability>>
<</if>>
<<EnemyBattleTable>>
<<elseif $pe eq 1>>
<<if $playeraction eq "attack">>You attempt to hit the $currentEnemy.fullname !
<<PlayerAttackAttempt>>
<<if $playeraction eq "attack success">>
<<PlayerAttackDamage>>
<<elseif $playeraction eq "attack failure">>
You missed your attack!
<</if>><</if>>
<<EnemyStun>>
<<if $enemyaction eq "attack">>The $currentEnemy.fullname prepares to attack you!
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">>
<<EnemyAttackDamage>>
<<elseif $enemyaction eq "attack failure">>
The $currentEnemy.fullname missed their attack!
<</if>><</if>>
<<if $playeraction eq "ability">>
<<Ability $ability>><</Ability>><</if>>
<<if $currentEnemy.NPCcurrenthealth lte 0>><<link "The enemy is slain! Victory!" $returnpassage>><<set $pe = 0>><<set $exp to $exp + $currentEnemy.enemyXP>><</link>>
You feel more experienced after winning with $currentEnemy.fullname !
<<set $loot to [$temperedbonefragment, $crimsonhideflake, $spiritvinetendril, $crackedflowcharm].random()>>
<p>You loot the corpse of the <<print $currentEnemy.fullname>> and find: <b><<print $loot.name>></b>.</p><<AddItemToInventory $loot>>
<<elseif $health lte 0>><<link "You've lost!" "GameOver">><</link>>
<<else>><<link "Continue battle" $passage>><<set $pe = 0>><</link>>
<</if>>
<</if>><<if $pe eq 0>>
You are fighting $currentEnemy.fullname !
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
<b>General Actions</b>:
<<link "Attack" "MissionBattle1">>
<<set $pe to 1>>
<<set $playeraction = "attack">>
<</link>>
<table class="abilities-table">\
<td>\
<b>Abilities</b>:
<<for _i to 0; _i lt $skillInventory.length; _i++>>\
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<<print $skillInventory[_i].name>> (Energy cost: $skillInventory[_i].energy )\
<<capture _i>>\
<<if $energy lt $skillInventory[_i].energy>><i>Not enough energy</i>
<<else>> <<link "Use" "MissionBattle1">>
<<set $pe = 1>><<set $playeraction = "ability">> <<set $ability = $skillInventory[_i].widgetname>> <<set $abilityenergy = $skillInventory[_i].energy>><<set $energy -= $abilityenergy>> <<set $abilitylevel = $skillInventory[_i].level>> <</link>> <</if>>
<</capture>>\
<</if>>
<</for>>\
</td>\
</table>
<<if $activePassiveSkill != "">>
<<Ability $activePassiveWidget>><</Ability>>
<</if>>
<<EnemyBattleTable>>
<<elseif $pe eq 1>>
<<if $playeraction eq "attack">>You attempt to hit the $currentEnemy.fullname !
<<PlayerAttackAttempt>>
<<if $playeraction = "attack success">>
<<PlayerAttackDamage>>
<<elseif $playeraction eq "attack failure">>
You missed your attack!
<</if>><</if>>
<<EnemyStun>>
<<if $enemyaction eq "attack">>The $currentEnemy.fullname attacks you!
<<EnemyAttackAttempt>>
<<if $enemyaction = "attack success">>
<<EnemyAttackDamage>>
<<elseif $enemyaction eq "attack failure">>
The $currentEnemy.fullname missed their attack!
<</if>><</if>>
<<if $playeraction eq "ability">>
<<Ability $ability>><</Ability>><</if>>
<<if $currentEnemy.NPCcurrenthealth lte 0>> <<link "The enemy is slain! Victory!" $returnpassage>><<set $pe = $nextPe>><</link>>
<<elseif $health lte 0>><<link "You've lost!" $returnpassage>> <<set $pe to $nextPe += 1>> <</link>>
<<else>><<link "Continue battle" $passage>><<set $pe = 0>> <</link>>
<</if>>
<</if>><<nobr>>
<<if $pe eq 0>>
<br>You are fighting $currentEnemy.fullname !
<br><<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
<br><b>General Actions</b>:
<br><<link "Attack" "TavernBattle">>
<<set $pe to 1>>
<<set $playeraction = "attack">>
<</link>>
<br><<link "Surrender" "TavernBattle">>
<<set $pe to 1>>
<<set $playeraction = "surrender">>
<</link>>
<table class="abilities-table">
<td>
<b>Abilities</b>:
<<for _i to 0; _i lt $skillInventory.length; _i++>>\
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<br><<print $skillInventory[_i].name>> (Energy cost: $skillInventory[_i].energy )
<<capture _i>>
<<if $energy lt $skillInventory[_i].energy>><i>Not enough energy</i>
<<else>> <<link "Use" "TavernBattle">>
<<set $pe = 1>><<set $playeraction = "ability">> <<set $ability = $skillInventory[_i].widgetname>> <<set $abilityenergy = $skillInventory[_i].energy>><<set $energy -= $abilityenergy>> <<set $abilitylevel = $skillInventory[_i].level>> <</link>> <</if>>
<</capture>>
<</if>>
<</for>>
</td>
</table>
<<if $activePassiveSkill != "">>
<<Ability $activePassiveWidget>><</Ability>>
<</if>>
<<EnemyBattleTable>>
<<elseif $pe eq 1>>
<br><<if $playeraction eq "attack">>You attempt to hit the $currentEnemy.fullname !
<<PlayerAttackAttempt>>
<<if $playeraction = "attack success">>
<br><<PlayerAttackDamage>>
<<elseif $playeraction eq "attack failure">>
<br>You missed your attack!
<</if>><</if>>
<<EnemyStun>>
<br><<if $enemyaction eq "attack">>The $currentEnemy.fullname attacks you!
<<EnemyAttackAttempt>>
<<if $enemyaction = "attack success">>
<br><<EnemyAttackDamage>>
<<elseif $enemyaction eq "attack failure">>
<br>The $currentEnemy.fullname missed their attack!
<</if>><</if>>
<<if $playeraction eq "ability">>
<br><<Ability $ability>><</Ability>><</if>>
<<if $playeraction eq "surrender">>
<br>You have surrendered. You lost the battle.
<<set $health = 0>>
<</if>>
<br><<if $currentEnemy.NPCcurrenthealth lte 0>><<link "The enemy is defeated! Victory!" $returnpassage>><<set $pe = $nextPe>><</link>>
<br><<elseif $health lte 0>><<link "You've lost...." $returnpassage>><<set $pe = $nextPe += 1>><</link>>
<br><<else>><<link "Continue battle" $passage>><<set $pe = 0>><</link>>
<</if>>
<</if>>
<</nobr>><div class="battle-container">
<<if $pe eq 0>>
/* --- 1. TOURNAMENT INITIATIVE CHECK --- */
<<if ndef $battleRound>>
<<set $battleRound = 1>>
<<set _playerSpeed = $agility + Math.floor($luck / 5) + random(1, 100)>>
<<set _enemySpeed = ($currentEnemy.agility || 100) + random(1, 100)>>
<<if _enemySpeed > _playerSpeed>>
<div class="combat-log-panel ambush-alert">
<h3 class="log-title" style="color:#ff4c4c;">⚠️ Fast Exchange</h3>
<div class="log-entry">
<i>$currentEnemy.fullname is incredibly swift! They strike before you can finish your salute!</i>
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">You parried the sudden opening blow!</span><</if>>
</div>
</div>
<<if $health lte 0>>
<div class="battle-resolution">
<<link "Eliminated from the Tournament..." "Tournament|Region1">>
<<set $pe to "lost">><<unset $battleRound>>
<</link>>
</div>
<</if>>
<<else>>
<div class="combat-log-panel initiative-alert">
<h3 class="log-title" style="color:#4ade80;">⚡ Tactical Advantage</h3>
<div class="log-entry"><i>Your focus is absolute. You seize the first move of the match!</i></div>
</div>
<</if>>
<</if>>
<div class="enemy-presentation">
<span class="realm-tag">[$currentEnemy.realm]</span>
<h2 class="combat-title">Challenger: $currentEnemy.fullname</h2>
<div class="enemy-portrait-frame">
<<EnemyImage $currentEnemy.enemyregion $currentEnemy.enemyimage 300>><</EnemyImage>>
</div>
<div class="enemy-stats-wrapper">
<<EnemyBattleTable>>
</div>
</div>
<<if $activePassiveSkill != "">>
<div class="passive-notification-box">
<span class="buff-icon">🌀</span> <<Ability $activePassiveWidget>><</Ability>>
</div>
<</if>>
<div class="combat-actions-panel">
<div class="action-column">
<h3>Martial Stance</h3>
<div class="action-button-container">
<<link "BASIC STRIKE" "TournamentBattle|Region1">>
<<set $pe to 1>><<set $playeraction = "attack">>
<</link>>
</div>
</div>
<div class="action-column">
<h3>Divine Abilities</h3>
<div class="ability-list">
<<for _i to 0; _i lt $skillInventory.length; _i++>>
<<if ($skillInventory[_i].category eq "attack" or $skillInventory[_i].category eq "special") and $skillInventory[_i].isEquipped eq "true">>
<div class="ability-row">
<div class="ability-info">
<span class="ability-name"><<print $skillInventory[_i].name>></span><br>
<span class="ability-cost">Qi: $skillInventory[_i].energy</span>
</div>
<div class="ability-action">
<<capture _i>>
<<if $energy lt $skillInventory[_i].energy>>
<span class="not-enough-qi">Low Qi</span>
<<else>>
<div class="invoke-button-container">
<<link "INVOKE" "TournamentBattle|Region1">>
<<set $pe = 1>><<set $playeraction = "ability">>
<<set $ability = $skillInventory[_i].widgetname>>
<<set $abilityenergy = $skillInventory[_i].energy>>
<<set $energy -= $abilityenergy>>
<<set $abilitylevel = $skillInventory[_i].level>>
<</link>>
</div>
<</if>>
<</capture>>
</div>
</div>
<</if>>
<</for>>
</div>
</div>
</div>
<<elseif $pe eq 1>>
<div class="combat-log-panel">
<h3 class="log-title">Tournament Exchange</h3>
<div class="log-entry player-turn">
<<if $playeraction eq "attack">>
<b>You</b> strike at $currentEnemy.fullname!
<<PlayerAttackAttempt>>
<<if $playeraction eq "attack success">><<PlayerAttackDamage>>
<<else>><span class="miss-text">Your opponent deftly evaded!</span><</if>>
<<elseif $playeraction eq "ability">>
<div class="ability-execution-style">
<<Ability $ability>><</Ability>>
</div>
<</if>>
</div>
<hr class="combat-divider">
<div class="log-entry enemy-turn">
<<EnemyStun>>
<<if $enemyaction eq "attack">>
<b>$currentEnemy.fullname</b> retaliates!
<<EnemyAttackAttempt>>
<<if $enemyaction eq "attack success">><<EnemyAttackDamage>>
<<else>><span class="miss-text">You parried the counter-attack!</span><</if>>
<</if>>
</div>
<div class="battle-resolution">
<<if $currentEnemy.NPCcurrenthealth lte 0>>
<<link "Victory! Advance in Rank" $returnpassage>>
<<set $pe = $nextPe>><<unset $battleRound>>
<</link>>
<<elseif $health lte 0>>
<<link "Defeat! Eliminated" "Tournament|Region1">>
<<set $pe to "lost">><<unset $battleRound>>
<</link>>
<<else>>
<<link "Continue the Match" "TournamentBattle|Region1">>
<<set $pe = 0>><<set $battleRound++>>
<</link>>
<</if>>
</div>
</div>
<</if>>
</div><<if $regioneventid eq "01">>
<!--The Bamboo Grove of Whispers -->
<<if $pe eq 0>>
The grove is hushed, save for the sigh of bamboo swaying like an endless sea. Yet beneath the rustle, whispers slither-too deliberate to be mere wind.
They curl around your thoughts, beckoning you deeper… or tempting you to open your spirit to them.
[[Follow the whispers->NormalEvents][$pe=1]]
[[Meditate within the grove ->NormalEvents][$pe=2]]
<<link "Leave silently" $passage>><</link>>
<<elseif $pe eq 1>>
<<WhisperingShade>>
<<BeforeBattle>>
You follow the eerie voices deeper into the grove. The air thickens, and a ghostly cultivator steps from the shadows, his eyes hollow but fierce. His silence speaks of ancient grudges. You must fight for the whispers to fade.
<<link "Draw your weapon and prepare to fight" "Battle1">><<set $returnpassage to passage()>><<set $passage to "Battle1">><<set $pe to 0>><</link>>
<<link "Retreat" $passage>><</link>>
<<elseif $pe eq 2>>
You cross your legs beneath the whispering bamboo, shutting your eyes.
The voices seep into your mind, at first a storm of nonsense-then, threads of meaning reveal themselves: forgotten teachings, lost sutras, riddles of mortality.
Your qi flows steadier, like a river guided into its true course. When you finally rise, the grove feels less haunting - yet a lingering sense of being watched trails behind you.
<b>You've gained some Insight!</b>
<<link "Leave" $passage>><<set $baseinsight +=2>><</link>>
<<elseif $pe eq 3>>
The ghostly cultivator lets out a silent wail as your strike severs his form. He dissolves into threads of light that scatter among the bamboo, and the whispers at last fall quiet.
Among the fading motes, you find a shard of jade etched with runes-it hums faintly with residual power.
<<link "Leave the grove" "Map|Region1">><<set $baseinsight +=1>> <</link>>
<<elseif $pe eq 4>>
The shade’s blade pierces your defenses, its cold touch dragging at your very soul. The bamboo leans closer, whispering your failures.
With the last of your will, you stagger free from the grove. Though you live, your qi feels frayed-tainted by lingering resentment.
<<set $health -= 0.25*$basemaxhealth>>
<<set $baseluck -= 1>>
<<link "Stumble away from the grove" "Map|Region1">><</link>>
<</if>>
<<elseif $regioneventid eq "02">>
<<if $pe eq 0>>
<!-- The Crying Lotus-->
<img src="images/Story/bloodlotus.jpg" width=512>
A lotus blooms in the middle of a bloodied pond. Its petals are the color of fresh wounds, and from its heart drips a single crystalline tear that never falls.
The whispers of the pond beg for attention-yet whether they are prayers, curses, or illusions, you cannot tell.
[[Touch the lotus->NormalEvents][$pe=1]]
[[Sing to the lotus ->NormalEvents][$pe=2]]
<<link "Leave silently" $passage>><</link>>
<<elseif $pe eq 1>>
The tear rolls onto your skin-searing like molten metal, yet freezing your veins. You stagger as agony and clarity crash together.
For a moment, you see endless rivers of blood, wars fought over flowers like this one. When your vision clears, your soul feels steadier, less vulnerable to deceit.
You clutch the Iron-Blood Lotus Seed, still warm from the tear.
<<link "Leave" $passage>><<set $basespiritualRoot +=1>><</link>>
<<AddItemToInventory $ironbloodlotusseed>>
<<elseif $pe eq 2>>
You hum a gentle tune, and the blood-stained pond stills. The lotus tilts toward you, offering a crystalized tear. It shimmers with purity and potential-alchemy awaits.
<<link "Leave" $passage>><<set $baseinsight +=1>><</link>>
<<AddItemToInventory $ironbloodlotusseed>>
<</if>>
<<elseif $regioneventid eq "03">>
<<if $pe eq 0>>
Amid shattered stone and mossy ruins, you find a jug half-buried in earth.
The seal is old, the clay cracked, yet from within drifts a fragrance so potent it bends your knees. It is wine of the heavens, once brewed by a hand that defied mortality.
<!-- Drunken Immortal’s Jug-->
[[Drink->NormalEvents][$pe=1]]
[[Save it ->NormalEvents][$pe=2]]
<<link "Leave silently" $passage>><</link>>
<<elseif $pe eq 1>>
The wine is wild fire and starlight. Your body stumbles, your laugh escapes unbidden. Power surges, unbalanced and fierce. You may fall, or you may ascend-only fate decides tonight.
<<set _roll to random(0,100)>>
<<if _roll gte 70>>
You've failed to grasp essence of power!
Your experience has slightly decreased!
<<set $exp -= 0.1*$exp>>
<<else>>
You've succeed!
You've grasped essence of power! Your experience has increased slightly!
<<set $exp += 0.2*$exp+random(100,500)>>
<</if>>
<<link "Leave" $passage>><</link>>
<<elseif $pe eq 2>>
With iron will, you force the jug’s scent from your lungs and reseal it. The fragrance lingers like celestial music, promising strength when fate grows cruel.
Legends whisper that this wine tempers tribulation fire-what is calamity to one who laughs at the heavens?
<<link "Leave" $passage>><</link>>
<<AddItemToInventory $moltengolddew>>
<</if>>
<<elseif $regioneventid eq "04">>
<<if $pe is 0>>
A monstrous figure blocks your path-a humanoid pig, tusks curling, bristling with muscle and raw energy.
Its gaze fixes on you like a predator sizing prey.
<!-- Demon Pig’s Trial -->
<<if $demon_pig_encountered neq 1>>\
<<link "Fight it" "NormalEvents">><<set $pe = 1>><</link>>\
<<link "Offer food" "NormalEvents">><<set $pe = 2>><</link>>\
<<link "Try to appease it" "NormalEvents">><<set $pe = 3>><</link>>\
<<else>>\
<<if $demon_pig_result eq "fight">>\
The demon pig grunts, eyes narrowing as it recognizes you. It steps aside, acknowledging your strength.
<<link "Leave silently" $passage>><</link>>\
<<elseif $demon_pig_result eq "food">>\
The demon pig grunts in recognition, stepping aside to let you pass. It seems to remember your kindness.
<<link "Leave silently" $passage>><</link>>\
<<elseif $demon_pig_result eq "appease">>\
<<nobr>>
<br>It lunges before you can flee. Its tusks press into your shoulders as massive hands grip your hips.
<br><span class="male">“Did you miss me?”</span> its growl seems to echo in your mind. Its cock slams into your cunt before you can react, shoving you to the ground in doggy style.
<br>You gasp and whimper as it thrusts relentlessly, each grunt pounding your cunt harder than the last. Pain and pleasure collide, your body betraying your hesitation. <br>Cum rushes hot, thick, helplessly from your pussy as the beast groans and fills you again.
<br><<set _random to random(1,3)>><<if _random eq 1>><img src="images/Sex/demonpig.webp" class="nsfw-glow"><<elseif _random eq 2>><img src="images/Sex/demonpig1.webp" class="nsfw-glow"><<elseif _random eq 3>><img src="images/Sex/demonpig2.webp" class="nsfw-glow"><</if>>
<br>You've been slighlty corrupted by demonic energy!
<br>
<br><<link "Leave" $passage>><<set $demon_pig_encountered to 1>><<set $demon_pig_result to "appease">><<set $exp += random(50,150)>><<set $baseluck += 1>><<set $corruption += 3>><<set $health -= 0.1*$basemaxhealth>><<set $PCdemonicreputation += random(1,3)>><<set $sexFame += random(1,3)>> <</link>> <</nobr>>
<</if>>
<</if>>
<<elseif $pe eq 1>>
<<nobr>>
<br>The pig charges with astonishing speed. Its tusks gleam with malevolent energy, and you clash, qi against brute muscle.
<br>Victory smells of sweat, blood… and sizzling pork. <br>Demon pig run away, badly wounded.
<br>
<br>You've gained some experience!
<br><<link "Leave" $passage>><<set $demon_pig_encountered to 1>><<set $demon_pig_result to "fight">><<set $exp += random(100,300)>><<set $baseluck += 1>><<set $health -= 0.1*$basemaxhealth>> <</link>><</nobr>>
<<elseif $pe eq 2>>
<<nobr>>
<br>You offer a steamed bun with shaking hands.
<br>The pig snorts, eyes bright, and devours it. Its gaze softens for a moment, then it grunts, stepping aside.
<br>You've gained some insight!
<br><<link "Leave" $passage>><<set $demon_pig_encountered to 1>><<set $demon_pig_result to "food">><<set $exp += random(50,150)>><<set $baseluck += 1>><<set $baseinsight += 1>><</link>><</nobr>>
<<elseif $pe eq 3>>
<<nobr>>
<br>The pig stands before you, towering and impossibly muscular, its nostrils flaring as it studies you like prey.
A guttural growl rumbles from deep within its chest. You step back instinctively, but the beast’s sheer weight and speed leave no room for evasion. Its hands close around your shoulders, shoving you forward.
<br>
<br>You stumble onto your hands and knees, the cold, damp forest floor pressing against your skin. The pig looms behind, tusks glinting, eyes burning with unrestrained hunger. Your protests are muffled by the raw force of its dominance; every movement it makes is deliberate, claiming, powerful.
<br>
<br>Before you can react, it presses its thick, muscled body against yours. Your legs wobble, trapped. Its snout nuzzles your neck, hot breath brushing your ear, and you feel it press its massive cock against your cunt.
<<linkreplace "Continue">>
<<set _random to random(1,3)>><<if _random eq 1>><img src="images/Sex/demonpig.webp" class="nsfw-glow"><<elseif _random eq 2>><img src="images/Sex/demonpig1.webp" class="nsfw-glow"><<elseif _random eq 3>><img src="images/Sex/demonpig2.webp" class="nsfw-glow"><</if>>
<br>Hands-calloused, strong, impossible-grip your hips, shoving you onto all fours. You gasp, but it doesn’t stop. Each thrust drags your pussy across the dirt, every grunt from the beast vibrating through your cunt. You try to pull away, but its hold is relentless.
<br>Its rutting grows rougher, tusks grazing your shoulders, cock pounding your cunt with brutal force. You whimper, shiver, cry out, and hate how your cunt clenches around it anyway, soaking the earth.
<br>You are pushed into the ground, your back arching as it drives deep and fast. Its cum hits your cunt hard, thick and hot, leaving you trembling, soaked, gasping. Your own climax tears through you, helpless, overwhelmed, cunt quivering as it empties itself inside you.
<br>The Demon Pig finally steps back, snorting, leaving you bruised, sticky, cunt sore, trembling on the dirt. Humiliation mixes with heat as you clutch your ruined clothes and your quivering pussy, heart racing from the force of it.
<br>You've been slighlty corrupted by demonic energy!
<br>
<<if $virginity eq 1>>
<<set $virginity = 0>>
<<set $virginityLost = "Demon Pig">>
<span class="red">You lost your virginity to $virginityLost!</span>
<</if>>
<br><<link "Leave" $passage>><<set $demon_pig_encountered to 1>><<set $demon_pig_result to "appease">><<set $exp += random(50,150)>><<set $baseluck += 1>><<set $corruption += 3>><<set $health -= 0.1*$basemaxhealth>><<set $PCdemonicreputation += random(1,3)>><<set $sexFame += random(1,3)>> <</link>> <</linkreplace>><</nobr>>
<</if>>
<<elseif $regioneventid eq "05">>
<<if $pe eq 0>>
<!-- Nine-Tailed Fox Illusion-->
[[Approach her->NormalEvents][$pe=1]]
[[Observe silently ->NormalEvents][$pe=2]]
[[Dispel the illusion ->NormalEvents][$pe=3]]
<<elseif $pe eq 1>>
Her song is heartbreak and longing. As you draw near, the world blurs. If luck favors you, you awaken with her blessing. If not... time slips from your grasp like mist.
<<link "Leave" $passage>><</link>>
<<elseif $pe eq 2>>
You hide, watching her dance in the mist. The illusions swirl, but your gaze stays true. Your mind steels itself against temptation. Insight dawns within.
<<link "Leave" $passage>><</link>>
<<elseif $pe eq 3>>
With a burst of qi, the mirage shatters. The woman fades like smoke. In her place lies a herb pulsing with residual enchantment.
<<link "Leave" $passage>><</link>>
<</if>>
<<elseif $regioneventid eq "06">>
<<if $pe eq 0>>
<!-- The Broken Bell Tower-->
At the edge of a forgotten temple stands a tower of splintered wood and rusted bronze.
The wind sighs through the cracks, and with every gust, the great bell groans-a ghost of a tone that once commanded armies of faith.
Carved on the foundation are the words: <b>"Let the faithful awaken; let the unworthy tremble."* </b>
Dust dances in the half-light. You feel the weight of countless forgotten prayers pressing on your chest.
[[Ring the bell->NormalEvents][$pe=1]]
[[Climb the tower ->NormalEvents][$pe=2]]
<<link "Leave silently" $passage>><</link>>\
<<elseif $pe eq 1>> <!-- Ring the bell -->
You grip the old rope. The bell groans as you pull-its hollow note vibrates through your bones, stirring echoes of ancient voices.
A shimmer spreads from the ground, coalescing into the shape of a spectral monk. His lips move, but no sound escapes-only the resonance of peace.
He bows once, and the air calms. Where he stood, a faint crystal hums with rhythm and clarity.
<<AddItemToInventory $brightmeridiancrystal>>
<<set $baseinsight += 1>>
<<set $PCrighteousreputation += 1>>
<<link "Step away from the tower" $passage>><</link>>
<<elseif $pe eq 2>> <!-- Climb the tower -->
You climb carefully; the wooden steps creak beneath your weight. Dust swirls in the dim light filtering through broken beams.
At the top, the bell’s fracture gleams faintly under moonlight. Beneath it lies a set of folded prayer scrolls and a small pouch, sealed with dried wax.
Inside is a pinch of fine, silvery dust that glows when exposed to your breath- Meditation Dust, used by ancient cultivators to focus during breakthroughs.
<<AddItemToInventory $meditationdust>>
<<set $basewillpower += 1>>
<<link "Descend quietly" $passage>><</link>>
<</if>>
<<elseif $regioneventid eq "07">>
<<if $pe eq 0>>
<!-- The Snake and the Egg-->
Deep in the marshlands, fog swirls over black water. A low hiss cuts through the reeds.
A colossal serpent coils protectively around a single, pulsing egg-its scales shimmer like living jade, its eyes bright with wary intelligence.
Each breath it takes steams the air. You feel a flicker of ancient qi-this creature is not merely a beast, but a guardian.
[[Approach the serpent peacefully->NormalEvents][$pe=1]]
[[Attempt to steal the egg->NormalEvents][$pe=2]]
[[Watch from afar ->NormalEvents][$pe=3]]
<<link "Leave silently" $passage>><</link>>\
<<elseif $pe eq 1>> <!-- Peaceful approach -->
You kneel and channel calm qi through your palms, lowering your head.
The serpent watches you closely, muscles tensed to strike-then relaxes slightly as your aura harmonizes with its own.
It flicks its tongue, tasting your sincerity. A low hum vibrates through the marsh, and it sheds a single scale before slithering away into the mist.
<<AddItemToInventory $serpentpulsesalve>>
<<set $baseinsight += 1>>
<<set $PCrighteousreputation += 1>>
<<link "Leave the marsh" $passage>><</link>>
<<elseif $pe eq 2>><!-- Attempt to steal the egg -->
You dart forward, qi blazing, fingers closing around the slick shell-only for the serpent’s roar to split the silence.
It lashes out, and you barely raise your defense. Fangs graze your arm; venom sears your veins.
You manage to escape with the egg-but at a cost.
<<AddItemToInventory $serpentpulsesalve>>
<<set $health -= 0.15*$basemaxhealth>>
<<set $PCdemonicreputation += 1>>
<<link "Retreat, clutching your prize" $passage>><</link>>
<<elseif $pe eq 3>>
You linger in the shadows, studying the serpent’s breathing pattern and the subtle pulse of the egg.
Something ancient hums here-a rhythm of life and tribulation. You absorb what you can of its qi pattern before leaving, wiser but untouched.
<<set $baseinsight += 1>>
<<set $exp += random(10,150)>>
<<link "Withdraw from the marsh" $passage>><</link>>
<</if>>
<!-- Wounded Cultivator-->
<<elseif $regioneventid eq "08">>
<<if $pe eq 0>>
<<CreateNPC001>>
A wounded cultivator lies slumped against a tree, blood seeping between his fingers as he clutches his side. His breath is shallow, his robes torn, but his eyes flicker open when you approach.
<<set $currentSceneNPC to clone(_npc)>>
[[Go closer->NormalEvents][$pe=1]]
<<link "Leave" $passage>><</link>>
<<elseif $pe eq 1>>
You step closer, the smell of iron thick in the air. The cultivator’s lips twitch into a faint smile despite his injuries.
<span class="male">"C…Cultivator… help me,"</span> he whispers. His voice is hoarse, but there’s strength hidden beneath it.
<<linkreplace "Treat his wounds" "NormalEvents" >>
You kneel beside him, channeling a thread of spiritual energy into his wounds. The torn flesh knits slowly; his breathing steadies. He groans, body trembling under your touch.
<<set _lewdchance = random(1,100)>>
<<if _lewdchance <= 50>>
<span class="male">"You saved me,"</span> he murmurs, eyes closing for a moment in relief. <span class="male">"I won’t forget this debt."</span>
[[Continue->NormalEvents][$pe=3]]
<<else>>
His lips curve into a sly grin, even as the pain fades. <span class="male">"Such soft hands… it feels good when you touch me like that."</span> His eyes roam over your figure, shameless even in his weakened state.
The wounded cultivator leans closer, his hand brushing your wrist. <span class="male">"Stay a little longer,"</span> he whispers. <span class="male">"Let me repay your kindness… in another way."</span>
Despite his condition, his intent is clear: his other hand has already slipped lower, fingers grazing the bulge beneath his robes.
[[Scold him->NormalEvents][$pe=3]]
<<if $corruption gte 0>>[[Accept his offer->NormalEvents][$pe=2]]<</if>>
<</if>>
<</linkreplace>>
<<elseif $pe eq 2>>
You wrap your hand around his cock, surprised at the heat of him despite his injuries. Thick and heavy, it twitches against your palm as though his lust is stronger than his pain.
The cultivator exhales sharply, his back hitting the rough bark of the tree. <span class="male">"Nnh-your hands… softer than silk,"</span> he groans, his voice trembling between exhaustion and desire. His hips roll weakly, urging you to stroke him harder.
You start slow, dragging your palm along his shaft, feeling every vein pulse beneath your fingers. His cock grows harder with each stroke, precum beading at the tip and smearing slick trails across your knuckles. His hand shoots out, gripping your thigh as if to anchor himself in the haze of pleasure.
<span class="male">"Faster,"</span> he begs, panting. <span class="male">"Make me forget the pain…"</span>
You tighten your grip, sliding your hand up and down, wrist twisting just enough to make him buck against you. His cock jerks in your fist, leaking more with each motion, the smell of arousal thick in the cool forest air. His groans rise in pitch, echoing faintly through the trees.
<span class="male">"Spirits… you’re draining me more than any battle,"</span> he mutters, his head rolling back. He tries to keep his composure, but each ragged gasp betrays his growing desperation.
You milk him faster, your strokes firm and unrelenting until his whole body trembles. His cock pulses violently in your hand, and with a guttural moan he finally spills, hot streams of cum painting across his torn robes and dripping down his abdomen.
He slumps back, sweat-damp hair clinging to his forehead. His chest rises and falls as he catches his breath, but even spent, a crooked grin spreads across his lips.
<span class="male">"You… hah… you’ve healed me and left me undone in another way. I won’t forget the feel of those hands… ever."</span>
<<set $currentSceneNPC.hadSex to 1>>
<<set $corruption +=2>>
<<set $sexFame +=random(3,6)>>
<<link "Continue" "NormalEvents">><<set $pe to 3>><</link>>
<<elseif $pe eq 3>>
<<set _npc to $currentSceneNPC>>
The cultivator wipes his mouth, steadying himself. His gaze lingers on you.
He bows his head slightly. <span class="male">"You have my thanks. If fate allows, we will meet again."</span>
<<link "Remember him" $passage>> <<AddNPCWithFamily $currentSceneNPC>> <</link>>
<<link "Forget him" $passage>><</link>>
<</if>>
<!-- Drunk Wanderer Event -->
<<elseif $regioneventid eq "09">>
<<if $pe eq 0>>
A red-faced mortal stumbles down the road, clutching a cracked jug of wine. His steps sway dangerously, and when he notices you, his lips split into a lopsided grin.
<span class="male">"Ahh… a beauty on the road! Come, come-drink with me, share my warmth!"</span> His words slur, and his free hand already reaches out toward you.
<<if $EventAction eq null>>
<<link "Indulge him and drink" "NormalEvents">><<set $EventAction to "drink">><</link>>
<<link "Ignore him and walk past" "NormalEvents">><<set $EventAction to "ignore">><</link>>
<<link "Mock him in front of others" "NormalEvents">><<set $EventAction to "mock">><</link>>
<<link "Push him away harshly" "NormalEvents">><<set $EventAction to "push">><</link>>
<<if $corruption gte 5>><<link "Let him touch you" "NormalEvents">><<set $pe to 1>><<set $EventAction to "touch">><</link>><</if>>
<<elseif $EventAction eq "drink">>
You accept the jug. The wine is cheap and burns your throat, but the man laughs loudly, slapping his knee.
<span class="male">"Hah! You’re better company than those village nags. Cultivator or not, you’ve got spirit!"</span>
He soon stumbles off, humming a broken tune.
<<link "Continue with your journey" $passage>><<set $EventAction to null>><</link>>
<<elseif $EventAction eq "ignore">>
You step past without a word. He curses weakly behind you, but he’s too drunk to follow.
<<link "Continue with your journey" $passage>><<set $EventAction to null>><</link>>
<<elseif $EventAction eq "mock">>
You smirk and say loudly, <span class="player">"Careful, old man, before you drown yourself in piss instead of wine."</span>
<<link "Continue with your journey" $passage>><<set $EventAction to null>><</link>>
Nearby mortals laugh cruelly. The wanderer’s face reddens with shame.
<<elseif $EventAction eq "push">>
He staggers closer, but you shove him hard. He falls on his ass in the dirt, clutching his wine like it’s his child.
<span class="male">"Ungrateful witch!"</span> he slurs, spitting on the ground.
<<link "Continue with your journey" $passage>><<set $EventAction to null>><</link>>
<</if>>
<<elseif $pe eq 1>>
You don’t stop him when his hand grazes your waist. The drunkard chuckles, pressing closer, his breath hot with wine.
<span class="male">"Such soft skin… hah, a goddess come down to walk with mortals. Let me… taste you."</span>
You allow his rough, wine-stained hands to paw at your body. His palm cups your breast clumsily through your robes, squeezing as if you were nothing more than a tavern wench.
<span class="male">"Heh… so soft… even immortals feel like women in the end…"</span> he mutters, grinding against you.
His cock is already hard under his filthy trousers, straining against the fabric.
Your hand slides down, tugging at his filthy trousers. His cock springs free, thick and already slick at the tip.
The drunk groans in disbelief, <span class="male">"Ahh… gods above… a fairy touching my cock…"</span> His voice trembles between awe and filth.
You stroke him firmly, your fingers curling around his shaft. His hips jerk helplessly, chasing your hand with drunken desperation.
<span class="male">"Faster… don’t stop… ahh, fuck-" </span>
He moans like an animal, seed spilling messily across his own chest and belly. He sags against you, panting and laughing at once.
<span class="male">"Hah… hah… blessed by heaven itself…" </span>
<<link "Continue with your journey" $passage>><<set $EventAction to null>><<set $sexFame += random(1,3)>><<set $PCdemonicreputation += random(1,3)>><<set $corruption += random(1,3)>><</link>>
<</if>>
<!-- Peasant Wedding -->
<<elseif $regioneventid eq "10">>
<<if $pe eq 0>>
Lanterns swing gently from wooden poles, their glow casting warm light over a village square.
Laughter and music fill the night: a peasant wedding feast in full swing. Red banners ripple in the evening wind, and mortals cheer with joy around simple wooden tables.
Several eyes turn toward you as you approach-the cut of your robes, the aura of Qi around you. A cultivator is no common guest here.
<<link "Approach the feast" "NormalEvents">><<set $pe to 1>><</link>>
<<link "Leave" $passage>><</link>>
<<elseif $pe eq 1>>
A long wooden table is crowded with steaming dishes and rice wine. The villagers bow deeply, making space for you.
An elder bows low.
<span class="male">"Immortal, your presence blesses this humble union. Please, share our feast."</span>
<<link "Join them politely" "NormalEvents">><<set $pe to 3>><</link>>
<<link "Decline with cold pride" $passage>><</link>>
<<link "Cause trouble" "NormalEvents">><<set $pe to 2>><</link>>
<<elseif $pe eq 2>>
You sneer at their meager offerings. <span class="player">"This wine is weak. These dishes are fit only for pigs."</span>
The crowd trembles; some glare, but none dare speak.
Children cry softly as the elder bows, begging you not to ruin the day.
<<link "Continue with your journey" $passage>><<set $PCdemonicreputation +=random(1,3)>><</link>>
<<elseif $pe eq 3>>
You sit among them. The mortals pour rice wine into your cup with shaking hands, watching your every movement.
Children sneak glances at you, as if staring too long might blind them.
<<set _nsfwchance = random(1,100)>>
The feast drags into the night, laughter mixing with the crackle of torches.
<<linkreplace "Offer a gift to the couple" "NormalEvents">>
<<set $PCrighteousreputation += random(1,3)>>
You produce a small pouch of spirit stones and set it before the elder. The crowd gasps.
<span class="player"> "Blessings upon your union,"</span> you intone.
Your magnanimity will be remembered.
<</linkreplace>>
<<linkreplace "Stay silent, enjoy food" "NormalEvents">>
The wedding fades behind you as you step back onto the road. Mortals return to their joy, unaware-or willfully blind-to what transpired beneath the moonlight.
<<link "Continue with your journey" $passage>><</link>>
<</linkreplace>>
<<if _nsfwchance <= 40>>
<<link "Later in the night…" "NormalEvents">><<set $pe to 4>><</link>>
<</if>>
<<elseif $pe eq 4>>
<<set _brideorgroom = random(1,2)>>
<<if _brideorgroom == 1>>
<!-- Bride variant -->
The young bride, cheeks flushed from too much wine, grasps your sleeve.
Her wedding veil hangs loose, eyes glazed but yearning.
<span class="female">"Immortal… before I give myself to a mortal man, grant me a blessing. Let me taste divinity, if only once…"</span>
<<link "Indulge her" "NormalEvents">><<set $pe to 5>><</link>>
[[Gently refuse->$passage]]
<<else>>
The groom, staggering and drunk, collapses to his knees before you.
His eyes are wild with awe and wine.
<span class="male">"Great one…! Share your power with me tonight-let me *truly* honor this marriage bed." </span>
<<link "Indulge him" "NormalEvents">><<set $pe to 6>><</link>>
[[Shove him aside->$passage]]
<</if>>
<<elseif $pe eq 5>>
With a swift movement, you push her gently onto the soft grass behind the feast hall. Lantern light flickers across her face, wide eyes, lips parted, breath hitching.
<span class="player">"On your knees,"</span> you order, your hand gripping her hair lightly, tilting her head toward your waiting fingers.
She obeys immediately, hands clutching your thighs, eyes locked on yours as you slowly slide a finger into her wet cunt, teasing her. She gasps, shivering as your finger probes deeper.
<span class="player">"Gods… you’re so tight… my little mortal slut,"</span> you murmur, circling her clit with your thumb, watching her moan.
Her hands slide over your robes, tugging at them, desperate to feel your skin. You press your palm against her mouth, smirking.
<span class="player">"No touching yet… you’ll learn to obey,"</span> you whisper, thrusting two fingers inside her cunt. She moans loudly, hips jerking toward you.
<<linkreplace "Continue">>
<img src="images/Sex/lesbian.webp" class="nsfw-glow">
<span class="female">"Yes… yes, Mistress… please…",</span> she gasps, voice trembling. You push her onto her back, straddling her, grinding your cunt against hers. She bites her lip, whimpering as your wet pussy presses into hers.
You lean down, gripping her chin, forcing her eyes to meet yours.
<span class="player">"You’re mine tonight," </span> you growl, slipping a finger into her mouth while thrusting against her with your pussy. She sucks greedily, trying to taste the nectar of your arousal.
Her hands roam over your hips and breasts, tugging, kneading, desperate for more. You push her wrists above her head, smirking at her helplessness.
<span class="player">"Beg me to fuck you with my fingers… beg for it, slut,"</span> you demand. She gasps, trembling,
<span class="female">"Please… fuck me… make me cum, Mistress…"</span>
You plunge your fingers into her cunt, curling them expertly, watching her shudder, hips bucking. Her juices mix with yours, slick and dripping, painting the grass beneath you.
<span class="player">"Cum for me, little mortal… cum all over my fingers,"</span> you command. Her back arches, scream muffled against your hand, body trembling as she spills her first orgasm.
Not done yet, you grind your wet pussy against hers again, pressing her face into your chest, forcing her to taste your arousal. She moans around your nipple, writhing under your control.
<<link "Continue with your journey!" $passage>><<set $sexFame +=random(1,5)>><<set $PCdemonicreputation += random(1,4)>><<set $corruption +=random(1,3)>><</link>>
<</linkreplace>>
<!-- Groom variant -->
<<elseif $pe eq 6>>
The groom’s eyes blaze with drunken lust as he shoves you against the side of the tavern wall. His hands grip your shoulders, forcing you to look at him.
<span class="male">"I’m going to taste you… you’re mine tonight, immortal,"</span> he growls, fingers digging into your arms.
You try to pull away, but he shoves your robes open, exposing your soft, pale skin. His cock throbs visibly through his trousers, slick with arousal.
<span class="male">"Beg me… beg me to fuck your cunt,"</span> he snarls, shoving you down onto your knees.
<img src="images/Sex/sideBlowjob.webp" class="nsfw-glow">
Your breath catches, cheeks flushing, and your fingers clutch at his belt. His hands shove your head down toward his cock. You swallow around it, trembling as his length presses against your lips, hot and heavy.
<span class="male">"Lick it, whore… show me you’re worthy,"</span> he growls.
You obey, lips sliding down his cock as he groans, gripping your hair roughly. The taste of sweat and wine mixes with his pre-cum, slicking your lips and dripping onto your tongue. Every suck, every lick draws a sharp, guttural groan from him, and he thrusts into your mouth, forcing you deeper.
<<linkreplace "Continue">>
<span class="male">"Goddamn… your little cunt is going to taste every drop of my cum,"</span> he snarls, jerking his cock violently in your throat. You gag, choke, and moan around him, the sound lost under his heavy breathing.
<img src="images/Sex/pb.webp" class="nsfw-glow">
He shoves you onto the floor, straddling your chest roughly. His cock presses against your pussy, wet and needy. He thrusts hard, groaning as your cunt spreads around him, the tight warmth gripping him.
<span class="male">"So fucking tight… you like being my little slut, don’t you?"</span> he pants.
You whimper, nodding submissively, hands clutching at his arms as he slams into you over and over. His hips smash against yours, cock plunging deep, messy with your slick. You moan and whine, cunt dripping, body trembling under his violent thrusts.
<span class="male">"Fuck… cum for me, cunt… I’ll fill you with my sperm,"</span> he growls, grabbing your hair and forcing your head back as he shoves his cock in deeper. His hands roam over your body, pinching your nipples, squeezing your ass, leaving bruises as he fucks you ruthlessly.
Your body shakes, pussy clenching around him, and you cry out as your orgasm hits, slick spilling down your thighs. He doesn’t let up, fucking you through your climax, shoving his cum deep into your cunt until you’re nothing but a messy, trembling heap under him.
Finally spent, he collapses atop you, breathing heavily, sweat mixing with your own. Your hair is mussed, robes torn, cunt soaked with his cum.
<<if $virginity eq 1>>
<<set $virginity = 0>>
<<set $virginityLost = "random groom">>
<span class="red">You lost your virginity to $virginityLost!</span>
<</if>>
<<link "Continue with your journey!" $passage>><<set $sexFame +=random(1,5)>><<set $PCdemonicreputation += random(1,4)>><<set $corruption +=random(1,3)>><</link>>
<</linkreplace>>
<</if>>
<!-- Wandering Merchant Troupe -->
<<elseif $regioneventid eq "13">>
<<if $pe eq 0>>
<<nobr>>
<<set _merchantsReaction to "">>
<<set _fames to [
{type: "righteous", val: $totalPCrighteousreputation, min: 40},
{type: "demonic", val: $totalPCdemonicreputation, min: 40},
{type: "sex", val: $sexFame, min: 25},
{type: "general", val: $totalFame, min: 30},
]>>
<<set _top1 to {type: "none", val: 0}>>
<<set _top2 to {type: "none", val: 0}>>
/* ────────────── Find top two ────────────── */
<<for _f range _fames>>
<<if _f.val gte _top1.val>>
<<set _top2 = _top1>>
<<set _top1 = _f>>
<<elseif _f.val gte _top2.val>>
<<set _top2 = _f>>
<</if>>
<</for>>
<<set _primary = _top1.type>>
<<set _secondary = _top2.type>> /* ← just this, no condition */
<<if _top2.val is 0>>
<<set _secondary = "none">>
<</if>>
/* ──────────────────────────────────────────────── */
<<switch _primary>>
<<case "righteous">>
<<set _merchantsReaction to "reverent">>
<p>The merchants notice you immediately. Several bow deeply, eyes wide with recognition and respect.</p>
<p><<print either("An Elder of great virtue!", "A righteous cultivator walks among us!", "The heavens have sent a paragon!")>></p>
<<set _specialOffer to true>>
<<if _secondary is "sex">>
<p>…yet quite a few gazes linger with poorly concealed hunger.</p>
<<elseif _secondary is "demonic">>
<p>…though an unsettling shadow seems to cling to your aura.</p>
<<elseif _secondary is "combat">>
<p>The respect is tinged with healthy wariness of your battle prowess.</p>
<</if>>
<<case "demonic">>
<<set _merchantsReaction to "fearful">>
<p>The moment you approach, several merchants pale and step back. Whispers spread quickly: <<print either("It's the Blood Demon!", "The one who left the valley in corpses!", "Don't look her in the eye!")>>.</p>
<<if _secondary is "sex">>
<p>Still… some stares betray a dangerous, forbidden attraction.</p>
<<elseif _secondary is "righteous">>
<p>A few seem torn between terror and inexplicable awe.</p>
<</if>>
<p>One brave (or foolish) merchant steps forward, hands trembling.</p>
<<set _specialOffer to true>>
<<case "sex">>
<<set _merchantsReaction to "lustful">>
<p>More than a few merchants stare openly, eyes lingering far too long on your figure. Smirks and knowing glances are exchanged.</p>
<<if _secondary is "demonic">>
<p>The desire is mixed with genuine fear — a very dangerous combination.</p>
<<elseif _secondary is "combat">>
<p>They lust… but they also know better than to try anything foolish.</p>
<</if>>
<p>One particularly bold trader approaches with a sly smile.</p>
<<set _specialOffer to true>>
<<case "general">>
<<set _merchantsReaction to "respectful">>
<p>Word of your deeds has reached even these wandering traders. They treat you with cautious respect, offering slight bows and lowered voices.</p>
<<default>>
<<set _merchantsReaction to "normal">>
<p>The merchants greet you with practiced smiles — another cultivator, another potential customer.</p>
<</switch>>
<!------------------------------------ Merchant Interaction ------------------------------------------------------------------------------->
/* Reverent */
<<if _merchantsReaction is "reverent">>
<<set _roll to random(1,100)>>
<p><span class="merchant">"Honored cultivator!"</span> one of the senior merchants calls, bowing so low his forehead nearly touches the dirt. <span class="merchant">"Please, grace our humble caravan! We offer our finest wares... and perhaps our most devoted service."</span></p>
<<link "Browse their wares">>
<<goto "NormalEvents">>
<<set $pe to 2>>
<</link>>
<<if _roll lte 40>>
<p>The merchant’s son steps forward with a blush. <span class="male1">"Great Immortal, my father seeks a 'blessing' for our family line. Would you... consider a private session of Dual Cultivation? We offer a Jade Soul Pill as a dowry."</span></p>
<<if $corruption gt 20>>
<<linkreplace "Give blessing ♡">>
<<set $sexCumcount to 0, $sexPosition to "", $sexFinished to false>>
<<set $scene to 0>>
<<replace "#choice">>
<div id="casualSexContainer">
<<CasualSex "merchant father" "blessing" "dom" "full" "Map|Region1">>
</div>
<</replace>>
<</linkreplace>>
<<else>>
<i> No way I could do that...</i>
<</if>>
<</if>>
<br><<link "Continue with your journey" "Map|Region1">><<set $pe to 0>><</link>>
/* Fearful */
<<elseif _merchantsReaction is "fearful">>
<p>The senior merchant swallows hard. <span class="merchant">"W-we have no quarrel with you, exalted one. Please... look at whatever you wish. Just... spare our lives."</span></p>
<div id="choice">
<br><<link "Browse their wares">>
<<goto "NormalEvents">>
<<set $pe to 2>>
<</link>>
<br><<linkreplace "Demand tribute">>
<<replace "#choice">>
<<set _angerRoll to random(1,100)>>
<<if _angerRoll <= 30>>
The merchants panic — several draw hidden weapons.
<<ScaredMerchants>>
<<BeforeBattle>>
<<link "To battle!" "Battle1">><<set $passage to "Battle1">><<set $pe=0>><<set $nextPe to 10>><</link>>
<<else>>
<p><span class="player">"Protection isn't free. I'll take your finest herbs as payment for not destroying you."</span></p>
They empty their best crates in terror.
<<set $demonicreputation to $demonicreputation + 3>>
You leave with far more than you expected.
<br><<link "Continue with your journey" "Map|Region1">><<set $pe to 0>><</link>>
<</if>>
<</replace>>
<</linkreplace>>
<<if $activeDaoImprint.skillid eq "devouringessence" or $corruption gt 40>>
<br><<linkreplace "Demand favour ♡">>
<<replace "#choice">>
<p><span class="player">"Your gold is useless to me. I want something else ♡."</span></p>
<<linkreplace "Demand favour ♡">>
<<set $sexCumcount to 0, $sexPosition to "", $sexFinished to false>>
<<set $scene to 0>>
<<replace "#choice">>
<div id="casualSexContainer">
<<CasualSex "scared merchant" "tribute" "dom" "full" "Map|Region1">>
</div>
<</replace>>
<</linkreplace>>
<</replace>>
<</linkreplace>>
<</if>>
<br><<link "Continue with your journey" "Map|Region1">><<set $pe to 0>><</link>>
</div>
/* Lustful */
<<elseif _merchantsReaction is "lustful">>
<p>The merchant eyes your curves with a hunger that borders on insanity. <span class="merchant">"Such a jade beauty... A few nights in my carriage and I'll give you a amazing pill. No one has to know, little bird."</span></p>
<div id="choice">
<<if $corruption gte 30>>
<<linkreplace "Accept the 'private transaction'♡">>
<<replace "#choice">>
<p><span class="player">"A private transaction sounds... intriguing. Lead the way."</span></p>
<<linkreplace "Special transaction ♡">>
<<set $sexCumcount to 0, $sexPosition to "", $sexFinished to false>>
<<set $scene to 0>>
<<replace "#choice">>
<div id="casualSexContainer">
<<CasualSex "the bold merchant" "special aphrodisiacs and spirit stones" "neutral" "full" "Map|Region1">>
</div>
<</replace>>
<</linkreplace>>
<<else>>
<i> No way I could do that...</i>
<</if>>
<</replace>>
<</linkreplace>>
<<linkreplace "Slap the suggestion away">>
<<replace "#choice">>
<<set $sexFame to Math.max(0, $sexFame - 2)>>
<<set $fame to $fame + 1>>
You coldly decline. The merchant backs away, muttering apologies.
<span class="player">"Keep your filthy thoughts to yourself."</span>
<span class="merchant">"Of course, of course... forgive my boldness."</span>
<<link "Browse their wares">>
<<goto "NormalEvents">>
<<set $pe to 2>>
<</link>>
<</replace>>
<</linkreplace>>
<br><<link "Continue with your journey" "Map|Region1">><<set $pe to 0>><</link>>
/* Respected */
<<elseif _merchantsReaction is "respectful">>
<p><span class="merchant">"A cultivator of renown graces our humble caravan,"</span> the leader says with a respectful bow. <span class="merchant">"Please, allow us to show our appreciation with discounted prices."</span></p>
<<link "Browse their wares">>
<<goto "NormalEvents">>
<<set $pe to 2>>
<</link>>
<br><<link "Continue with your journey" "Map|Region1">><<set $pe to 0>><</link>>
/* Normal */
<<else>>
<p>The merchants greet you with professional smiles. <span class="merchant">"Welcome, traveler! Finest wares from the four directions — pills, talismans, spirit stones, rare ingredients. What catches your eye?"</span></p>
<<link "Browse their wares">>
<<goto "NormalEvents">>
<<set $pe to 2>>
<</link>>
<<link "Ask for rumors and information">>
<<goto "Map|Region1">>
<</link>>
<br><<link "Continue with your journey" "Map|Region1">><<set $pe to 0>><</link>>
<</if>>
<</nobr>>
<<elseif $pe eq 10>>
You emerge victorious from the battle, some merchants fleeing into the woods, other bleeding out on the ground. You gather what you can from the wrecked caravan before continuing on your way.
<<set $gold += random(10,200)>>
<br><<link "Continue with your journey" "Map|Region1">><<set $pe to 0>><</link>>
<!------------------------------------------------------------------------- Browse wares! ---------------------------------------------------------------->
<<elseif $pe eq 2>>
<<set _currentOfferings to $wanderingMerchantInventory.randomMany(4)>>
<div class="merchant-header">
<h2>Wandering Merchant</h2>
</div>
<br><<link "Continue with your journey" "Map|Region1">><<set $pe to 0>><</link>>
<br>You open your satchel to reveal your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong>
<br>You can always try to <<link "sell your own items to the merchant" "NormalEvents">><<set $pe to 3>><</link>>!
<<nobr>>
<<if $purchase neq null>>
<p style="color: #4fc3f7; font-weight: bold; margin-top: 20px; text-align: center;">
<br>You have acquired <<print $purchase>>.
</p>
<<unset $purchase>>
<<unset $purchaseclass>>
<</if>>
<</nobr>>
<table class="merchant-table">
<thead>
<tr>
<th>Offer</th>
<th style="width: 150px; text-align: center;">Price</th>
<th style="width: 100px; text-align: center;">Purchase</th>
</tr>
</thead>
<tbody>
<<for _i to 0; _i lt _currentOfferings.length; _i++>>
<<set _item to _currentOfferings[_i]>>
<tr>
<td>
<div class="item-name"><<print _i + 1>>. <<print _item.name>></div>
<div class="item-desc"><<print _item.description>></div>
</td>
<td style="text-align: center; vertical-align: middle;">
<div class="item-price"><<print _item.price>> Spirit Stones</div>
</td>
<td style="text-align: center; vertical-align: middle;">
<<if _item.price gt $gold>>
<span class="not-enough">Not enough gold</span>
<<else>>
<<capture _item>>
<<link "Buy" "NormalEvents">>
<<set _found to false>>
<<set _index to -1>>
<<for _j to 0; _j lt $playeriteminventory.length; _j++>>
<<if $playeriteminventory[_j].name === _item.name>>
<<set _found to true>>
<<set _index to _j>>
<<break>>
<</if>>
<</for>>
<<if _found>>
<<set $playeriteminventory[_index].quantity += 1>>
<<else>>
<<set _newItem to clone(_item)>>
<<set _newItem.quantity to 1>>
<<set $playeriteminventory.push(_newItem)>>
<</if>>
/* Deduct gold and show purchase message */
<<set $gold -= _item.price>>
<<set $purchase to _item.name>>
<<set $purchaseclass to _item.class>>
<</link>>
<</capture>>
<</if>>
</td>
</tr>
<</for>>
</tbody>
</table>
<!-------------------------------------------------------------------------Sell wares------------------------------------------------------------------->
<<elseif $pe eq 3>>
<<nobr>>
<div class="merchant-header">
<h2>Your items</h2>
</div>
<br><<link "Continue with your journey" "Map|Region1">><<set $pe to 0>><</link>>
<br>You open your satchel to reveal your Spirit Stones: <strong><span class="gold-amount"><<print $gold>></span> Spirit Stones</strong>
<br>You can always try to <<link "browse wares from merchants!" "NormalEvents">><<set $pe to 2>><</link>>!
<<nobr>>
<<if $purchase neq null>>
<p style="color: #4fc3f7; font-weight: bold; margin-top: 20px; text-align: center;">
<br>You have sold <<print $purchase>>.
</p>
<<unset $purchase>>
<<unset $purchaseclass>>
<</if>>
<</nobr>>
<table class="merchant-table">
<thead>
<tr>
<th>Offer</th>
<th style="width: 150px; text-align: center;">Price</th>
<th style="width: 100px; text-align: center;">Sell</th>
</tr>
</thead>
<tbody>
<<set _hasItems to false>>
<<for _i to 0; _i lt $playeriteminventory.length; _i++>>
<<if $playeriteminventory[_i].quantity gt 0>>
<<set _hasItems to true>>
<<capture _i>>
<tr>
<td>
<div class="item-name"><<print _i + 1>>. <<print $playeriteminventory[_i].name>></div>
<div class="item-desc"><<print $playeriteminventory[_i].description>></div>
<div class="item-desc">Quantity: <<print $playeriteminventory[_i].quantity>></div>
</td>
<td style="text-align: center; vertical-align: middle;">
<div class="item-price"><<print $playeriteminventory[_i].sellprice>> Spirit Stones</div>
</td>
<td style="text-align: center; vertical-align: middle;">
<<link "Sell" "NormalEvents">>
<<set $gold += $playeriteminventory[_i].sellprice>>
<<set $purchase to $playeriteminventory[_i].name>>
<<set $purchaseclass to $playeriteminventory[_i].class>>
<<set $playeriteminventory[_i].quantity -= 1>>
<</link>>
</td>
</tr>
<</capture>>
<</if>>
<</for>>
<<if _hasItems is false>>
<tr>
<td colspan="3" style="text-align: center;"><i>Your satchel is empty...</i></td>
</tr>
<</if>>
</tbody>
</table>
<</nobr>>
<<elseif $pe eq 4>>
<</if>>
<</if>>
<<if $randomeventid eq 14>>
EMPTY THO
<</if>><<widget "RichQiPlace_Region1">>
<b>You've stumbled upon a place brimming with rich spiritual energy! The air is thick with qi.</b>
The density of spiritual energy here is extraordinary — a place perfect for cultivation.
Do you want to cultivate?
<<link "Yes" "QiCultivation_Region1">><</link>>
<</widget>>
<<widget "RareHerbs_Region1">>
<b>While traveling, you stumble upon a patch of rare herbs growing beside the path. Their scent is rich, almost intoxicating.</b>
Their subtle fragrance suggests strong medicinal properties.
Do you want to gather them?
<<link "Yes" "RareHerbs_Region1">><</link>>
<</widget>>
<<widget "HerbFinder">>
<<for _i to 0; _i lt $playeriteminventory.length; _i++>>
<
<</for>>
<</widget>><<widget "RegionEvents">>
<<set _random to random(0,9999)>>
<<if _random gte 0 and _random lte 20>>
<!--The Bamboo Grove of Whispers-->
<<set $regioneventid to "01">>
<p>The grove is hushed, save for the sigh of bamboo swaying like an endless sea. Yet beneath the rustle, whispers slither - too deliberate to be mere wind. They curl around your thoughts, beckoning you deeper… or tempting you to open your spirit to them.</p>
<<link "Approach">>
<<goto "NormalEvents">>
<</link>>
<<elseif _random gt 20 and _random lte 40>>
<!-- The Crying Lotus-->
<<set $regioneventid to "02">>
<p>A lotus blooms in the middle of a bloodied pond. Its petals are the color of fresh wounds, and from its heart drips a single crystalline tear that never falls. The whispers of the pond beg for attention - yet whether they are prayers, curses, or illusions, you cannot tell.</p>
<<link "Approach">>
<<goto "NormalEvents">>
<</link>>
<<elseif _random gt 40 and _random lte 60>>
<!-- Drunken Immortal’s Jug-->
<<set $regioneventid to "03">>
<p>Amid shattered stone and mossy ruins, you find a jug half-buried in earth. The seal is old, the clay cracked, yet from within drifts a fragrance so potent it bends your knees. It is wine of the heavens, once brewed by a hand that defied mortality.</p>
<<link "Approach">>
<<goto "NormalEvents">>
<</link>>
<<elseif _random gt 60 and _random lte 80>>
<!-- Demon Pig’s Trial-->
<<set $regioneventid to "04">>
<p>A monstrous figure blocks your path - a humanoid pig, tusks curling, bristling with muscle and raw energy. Its gaze fixes on you like a predator sizing prey.</p>
<<link "Approach">>
<<goto "NormalEvents">>
<</link>>
<<elseif _random gt 80 and _random lte 100>>
<!-- Nine-Tailed Fox Illusion-->
<<set $regioneventid to "05">>
<p>Her song is heartbreak and longing. As you draw near, the world blurs. A beautiful woman with fox-like features dances in the mist, her tails swaying hypnotically.</p>
<<link "Approach">>
<<goto "NormalEvents">>
<</link>>
<<elseif _random gt 100 and _random lte 120>>
<!-- The Broken Bell Tower-->
<<set $regioneventid to "06">>
<p>At the edge of a forgotten temple stands a tower of splintered wood and rusted bronze. The wind sighs through the cracks, and with every gust, the great bell groans - a ghost of a tone that once commanded armies of faith.</p>
<<link "Approach">>
<<goto "NormalEvents">>
<</link>>
<<elseif _random gt 120 and _random lte 140>>
<!-- The Snake and the Egg-->
<<set $regioneventid to "07">>
<p>Deep in the marshlands, fog swirls over black water. A low hiss cuts through the reeds. A colossal serpent coils protectively around a single, pulsing egg - its scales shimmer like living jade, its eyes bright with wary intelligence.</p>
<<link "Approach">>
<<goto "NormalEvents">>
<</link>>
<<elseif _random gt 140 and _random lte 280>>
<!-- Wounded cult -->
<<set $regioneventid to "08">>
<p>A wounded cultivator lies slumped against a tree, blood seeping between his fingers as he clutches his side. His breath is shallow, his robes torn, but his eyes flicker open when you approach.</p>
<<link "Approach">>
<<goto "NormalEvents">>
<</link>>
<<elseif _random gt 280 and _random lte 430>>
<!-- Drunk Wanderer -->
<<set $regioneventid to "09">>
<p>A red-faced mortal stumbles down the road, clutching a cracked jug of wine. His steps sway dangerously, and when he notices you, his lips split into a lopsided grin.</p>
<<link "Approach">>
<<goto "NormalEvents">>
<</link>>
<<elseif _random gt 430 and _random lte 630>>
<!-- Mortal Weeding -->
<<set $regioneventid to "10">>
<p>Lanterns swing gently from wooden poles, their glow casting warm light over a village square. Laughter and music fill the night: a peasant wedding feast in full swing.</p>
<<link "Approach">>
<<goto "NormalEvents">>
<</link>>
<<elseif _random gt 630 and _random lte 830>>
<!-- Rare herbs -->
<<set $regioneventid to "11">>
<p>You discover a hidden patch of glowing herbs nestled in ancient soil. Their leaves pulse faintly with concentrated qi.</p>
<<link "Approach">>
<<goto "RareHerbs_Region1">>
<</link>>
<<elseif _random gt 830 and _random lte 1030>>
<!-- Qi cultivation -->
<<set $regioneventid to "12">>
<p>A serene clearing bathed in moonlight reveals itself. The qi here is thick and pure - perfect for meditation.</p>
<<link "Approach">>
<<goto "QiCultivation_Region1">>
<</link>>
<<elseif _random gt 1030 and _random lte 1230>>
<!-- Wandering Merchant Troupe -->
<<set $regioneventid to "13">>
<p>A colorful caravan of merchants has set up camp nearby, their tents vibrant against the natural backdrop. The air is filled with enticing aromas and the hum of lively bargaining.</p>
<<link "Approach">>
<<goto "NormalEvents">>
<</link>>
<<elseif _random gt 1230 and _random lte 9430>>
<</if>>
<</widget>><<if $pe eq 0>>
<<ArrogantYoungMaster>>
As you step closer to the disturbance, the young master stops mid-insult. He leaves the trembling server and turns his full, predatory attention toward you.
Up close, he is a youth no older than twenty, hair pinned with golden clasps, his silk robes shimmering with a faint spiritual glow that marks him as a pampered disciple. He scans you from head to toe, a sharp smirk spreading across his face.
<span class="male">“So,”</span> he says, voice dripping with unearned superiority. <span class="male">“A wandering insect thinks she can intervene? This tavern is full of rats, but you... you have a certain flavor.”</span>
He steps into your personal space, his entourage fanning out behind him with smug, expectant grins.
<span class="male">“Crawl to me on all fours, and I may forgive you for breathing my air.”</span>
The tavern goes deathly silent. He leans in closer, his eyes dark. <span class="male">“Or don’t. I’ll enjoy breaking your legs and watching you squirm in the dirt anyway.”</span>
<hr>
<div id="choice">\
<<link "Obey him. Crawl.">><<set $backgroundClass to "tavern">>
<<replace "#choice">>
The words hang in the air like poison.
<span class="male">“Crawl to me on all fours.”</span>
Laughter bubbles from his entourage, cruel and excited. The tavern watches in uncomfortable silence — but no one stops you as you slowly, deliberately, drop to your knees.
<<set _random0 = random(0,2)>>
You place your palms to the dusty wooden floor and begin to crawl toward him.
<<if _random0 eq 0>>
<img src="images/Sex/crawl.webp" class="nsfw-glow"><<elseif _random0 eq 1>>
<img src="images/Sex/crawl1.webp" class="nsfw-glow"><<elseif _random0 eq 2>>
<img src="images/Sex/crawl3.webp" class="nsfw-glow"><</if>>
<span class="male">“Good,”</span>he purrs, voice silk-wrapped steel. <span class="male">“See? Even lowly insects can learn obedience.”</span>
When you reach him, he lifts one foot and presses the sole of his ornate boot against your shoulder — not hard enough to hurt, but enough to assert dominance.
<span class="male">“Now beg me to let you serve me in private.”</span>
<<linkappend "You’re taken to a private backroom. The guards remain outside.">>
<<set $backgroundClass to "tavernRoom">>
Inside, the arrogant young master watches you with idle amusement as he reclines on a padded seat. He undoes the sash of his inner robe, letting it slide open just enough to reveal his bare chest… and the growing bulge beneath silk pants.
<span class="male">“Strip, then crawl here and use your mouth. You’ll start there, and if I’m pleased, I’ll use the rest of you.”</span>
On your knees before him, you free his cock — thick, flushed, already hard with anticipation. He’s arrogant about it too, holding your chin and tapping the tip against your lips before letting you take him into your mouth.
<span class="male">“Not bad… for a nobody.”</span>
<div style="position: relative; width: 70%; height: auto;">
<<BackgroundHandler>>
<img src="images/sideBlowjob.webp" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
</div>
He moans as you work your lips along his shaft, guiding your rhythm with one hand tangled in your hair. The position is degrading, and that’s exactly how he wants it.
After he’s had enough, he pulls back and stands.
<<Penetration_roll>>
<<if _penetration eq "vaginal">>
<<set _position to ["doggy","cowgirl"].random()>>
<<if _position eq "doggy">>
<<AymTavernImg>>
<<if $virginity eq 1>><<set $virginity = 0>><<set $virginityLost = _npc.fullname>>
<span class="red">You lost your virginity to _npc.fullname!</span>
<</if>>
<span class="male">“Turn around. On all fours — like the dog you are.”</span>
You obey, pressing your chest to the cushions as he mounts you from behind.
<<set_aym_doggy_desc>>
_random_desc_1
<<set_aym_doggy_talk>>
<span class="male">"_random_talk_1"</span>
_random_desc_2
<span class="male">"_random_talk_2"</span>
_random_desc_3
<span class="male">"_random_talk_3"</span>
<<linkappend "It wasnt really long before you heard a grunts of incoming orgasm from the guy.">>
<<AymFinisher>>
<span class="male"> "_finisher_talk_1" </span>
_finisher_desc_1
<<link "Gather your things and leave in shame" $passage>><<set $sexFame += random(4,7)>><<set $pe to 0>><<if $corruption lt 50>><<set $corruption +=2>><</if>><</link>>
<</linkappend>>
\
<<elseif _position eq "cowgirl">>
<<AymTavernImg>>
<<if $virginity eq 1>>
<<set $virginity = 0>>
<<set $virginityLost = _npc.fullname>>
<span class="red">You lost your virginity to _npc.fullname!</span>
<</if>>
<<set_aym_cowgirl_desc>>
_random_desc_1
<<set_aym_cowgirl_talk>>
<span class="male">"_random_talk_1"</span>
_random_desc_2
<span class="male">"_random_talk_2"</span>
_random_desc_3
<span class="male">"_random_talk_3"</span>
<<linkappend "It wasn't really long before you heard a grunts of incoming orgasm from the guy.">>
<<AymFinisher>>
\
<span class="male"> "_finisher_talk_1" </span>
_finisher_desc_1
\
<<link "Gather your things and leave in shame" $passage>><<set $sexFame += random(4,7)>><<set $pe to 0>><<if $corruption lt 50>><<set $corruption +=2>><</if>><</link>>
<</linkappend>>
<</if>>
\
<<elseif _penetration eq "anal">>
\
<<if $analVirginity eq 1>>
<<set $analVirginity = 0>>
<<set $analVirginityLost = _npc.fullname>>
<span class="red">You lost your anal virginity to _npc.fullname!</span>
<</if>>
\
<<AymTavernImg>>
<<set_aym_proneboneANAL_desc>>
_random_desc_1
<<set_aym_proneboneANAL_talk>>
<span class="male">"_random_talk_1"</span>
_random_desc_2
<span class="male">"_random_talk_2"</span>
_random_desc_3
<span class="male">"_random_talk_3"</span>
<<linkappend "It wasnt really long before you heard a grunts of incoming orgasm from the guy.">>
<<AymFinisher>>
<span class="male"> "_finisher_talk_1" </span>
_finisher_desc_1
<<link "Gather your things and leave in shame" $passage>><<set $sexFame += random(4,7)>><<set $pe to 0>><<if $corruption lt 50>><<set $corruption +=2>><</if>><</link>>
<</linkappend>>
<</if>>
<</linkappend>>
<</replace>>
<</link>>
<<link "Refuse with pride.">>
<<replace "#choice">>
You cross your arms and stare him down, utterly unmoved.
<span class="player">"I don't bow to worms dressed in silk."</span>
The room goes still.
The young master’s eyes flash with fury. <span class="male">“Break her knees.”</span>
<<if $totalFame gt 500>>
<<set _roll to random(0,100)>>
<<if _roll lt 50>>
<span class="male1">"Wait… that’s $playername $playersurname. The one who crippled a Core disciple with a single palm at the trial grounds.”</span>
_npc.fullname blinks. His hand freezes mid-gesture.
One of the guards leans in and whispers something urgently in his ear.
The young master’s face turns pale. He swallows.
<span class="male">“Tch. This place isn't worth dirtying my hands.”</span>
He spins on his heel, robes whipping the air. <span class="male">“Come, we’re leaving.”</span>
<<else>>
<span class="male1"> “Wait!”</span>One of his guards steps in front of him, looking visibly uneasy. <span class="male1"> “That’s the $playername $playersurname ”</span>The young master freezes. His lips press into a thin line.
Around the room, people are whispering your name. Several onlookers shift in their seats—one even lifts their cup in a silent toast.
<span class="male">“Tch… Don’t think your fame makes you untouchable forever.”</span> But the words are hollow. He turns and storms out, his entourage following, visibly shaken.
<</if>>\
<i>Try to stop him?</i>
<<link "Stop him!" "Arrogant Young Master Tavern">><<set $pe to 10>><</link>>
<<else>>
The room goes quiet. His smirk fades.
<span class="male">"Worm?"</span>His voice rises slightly. <span class="male">“Who the fuck do you think you are?”</span>
You sense it—the shift. There's no recognition in the room. No fear in the guards’ eyes. The patrons look away, uninterested. No one whispers your name.
You’re no one. Not yet.
The room goes quiet. His smirk fades.
<span class="male">"Worm?"</span>His voice rises slightly. <span class="male">“Who the fuck do you think you are?”</span>
You sense it—the shift. There's no recognition in the room. No fear in the guards’ eyes. The patrons look away, uninterested. No one whispers your name.
You’re no one. Not yet.
The young master’s face twists with fury.
<span class="male">“Then I’ll beat the dignity into you. I’ll break your legs and feed your spiritual root to dogs.”</span>
<<BeforeBattle>>
<<link "To battle!" "TavernBattle">><<set $pe to 0>><<set $nextPe to 1>><<set $passage to "TavernBattle">><</link>>
<</if>>
<</replace>>
<</link>>
<<link "Mock him back.">>
<<replace "#choice">>
The arrogant young master’s lip curls in contempt as he stands before you, his hand lazily gesturing to the floor.
<span class="male"> “Crawl to me, and I may spare you from becoming a cripple tonight.”</span>You lean back in your chair, smile slow and mocking.
<span class="player"> “You want me on all fours? Buy me dinner first, young master.”</span>
The moment hangs in the air like drawn steel. A few chuckles ripple through the tavern—but they die quickly. No one shouts your name. No gasps of recognition. You’re just… some nobody with a sharp tongue.
The young master’s smile fades.
<span class="male">“What did you just say?”</span>. His voice trembles—not from fear, but from barely suppressed rage. He turns slowly toward his guards.
<span class="male">Break their jaw. Then break their hands. Let’s see how funny they are with no tongue or fingers.”</span>
His guards start moving—this time with no hesitation.
<<BeforeBattle>>
<<link "To battle!" "TavernBattle">><<set $pe to 0>><<set $nextPe to 1>><<set $passage to "TavernBattle">><</link>>
<</replace>>
<</link>>
<<elseif $pe eq 1>>
<<nobr>>
<br>You catch the next guard’s wrist mid-swing.
<br>CRACK. His bone breaks in your grip. Another guard draws a sword—you flick two fingers, and his blade shatters.
<br>The young master stumbles back, wide-eyed. He stammers.
<br><span class="male">“Y-You dare hit me?! My father is the Sect Lord of—”</span>
<div id="choice">
<br><<link "Slap him across the face">>
<br><<replace "#choice">>
<br>You casually raise your hand—and deliver a thunderous slap.
<br><div style="position: relative; width: 70%; height: auto;"><<BackgroundHandler>><img src="images/Story/bitchslap.webp" style="width: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"></div>
<br>A shockwave ripples out. The young master spins mid-air before crashing into the bamboo thicket.
<br><span class="male">"Y-you—!"</span> He spits blood and teeth.
<br>The guards glance at each other—then drop their weapons and flee.
<br><span class="player">“Tell your father: the world doesn't bend for spoiled children.”</span>
<br><<link "Go back" $city>> <<set $PCrighteousreputation += 1>><<set $fame += random(3,6)>> <</link>>
<</replace>>
<</link>>
<br><<link "Step forward and crush his pride">>
<br><<replace "#choice">>
<br>You step closer, gaze like a blade.
<br><span class="player">"Your father's title means nothing here."</span>
<br>Your aura flares—dense, suffocating. He drops to his knees before he even realizes.
<br>He can't meet your eyes.
<br>The remaining guards scatter without a word.
<br>You turn away, leaving them behind like dust in the wind.
<br><<link "Go back" $city>> <<set $PCdemonicreputation += 1>> <<set $fame += random(3,6)>><</link>>
<</replace>>
<</link>>
<br><<link "Let him run—like the coward he is">>
<br><<replace "#choice">>
<br>You say nothing. Just look at him.
<br>The pressure in the air thickens. He trembles, then bolts into the forest, stumbling over his own ego.
<br>The remaining guards scatter like leaves.
<br><<link "Go back" $city>> <<set $fame += random(3,6)>> <</link>>
<</replace>>
<</link>>
</div>
<</nobr>>
<<elseif $pe eq 2>>
The arrogant young master towers above you as you sprawl on the tavern’s wooden floor, breath ragged from the blows his guards landed. The world smells of spilled wine and smoke, and every gaze in the room is fixed on you—waiting, whispering.
<span class="male">“Still defiant?” </span>
His voice drips with mockery. He presses the heel of his embroidered boot harder into your belly.
<span class="male">“Let’s see how long that dignity lasts, insect.”</span>
The pressure is unbearable. Your body spasms, bladder straining. You claw at the floorboards, cheeks flushing with humiliation. A choked sound escapes your throat as your muscles finally betray you.
A dark warmth spreads beneath you, soaking through the silk of your dress. The humiliating hiss of liquid is unmistakable as your thighs grow wet. You’re pissing yourself—helpless, humiliated, right there on the tavern floor.
Laughter ripples through the air. The young master leans closer, his hand sliding up your leg possessively, fingers pressing into your trembling thigh. His smirk is wide, cruel, triumphant.
<img src="images/Sex/piss.webp" style="width: 70%; display: block; margin: 10px auto;">
<span class="male">“There. Look at you now. A proud cultivator… reduced to a piss-soaked dog. Remember this the next time you dare raise your voice to me.”</span>
The puddle spreads, steam rising faintly in the heat of the tavern. Your blue eyes meet his for a fleeting moment—shame burning so hot it almost eclipses your fear. Almost.
<<link "Gather your things and leave in shame" $city>><<set $sexFame += random(2,5)>><<set $pe to 0>><<if $corruption lt 50>><<set $corruption +=2>><</if>><<set $combatFame -= 1>><<set $fame -= 2>><</link>>
<</if>><<set _npc to $currentEncounterNPC>>
<<if _npc is undefined>>
<p>Encounter data is missing.</p>
<<if $encounterOriginPassage>>
<<link "Back" $encounterOriginPassage>><</link>>
<</if>>
<<else>>
<<set _isMet to !!_npc.isMet>>
<<set _wasUnknown to !!_npc.isUnknown>>
<<set _sexualAdvanceFlag to false>>
<<set _playerHarassedFlag to false>>
<<set _playerForcedFlag to false>>
<div class="encounter-interaction">
<h3>
<<if !_isMet>>
Approaching a stranger...
<<elseif _npc.isRelative>>
Approaching <<print _npc.fullname>> — a familiar face...
<<else>>
Approaching <<print _npc.fullname>>...
<</if>>
</h3>
<div class="encounter-portrait-large">
<<if _npc.enemyimage and _npc.enemyregion>>
<img @src="'images/' + _npc.enemyregion + '/' + _npc.enemyimage + '.jpg'" width="80%" class="location-bg">
<<else>>
<div class="portrait-placeholder">❓</div>
<</if>>
</div>
<div id="interaction-result"></div>
<div id="choice-container">
<<if !_isMet>>
<<link "Introduce yourself">>
<<set _npc.isMet to true>>
<<set _npc.isUnknown to false>>
<<if !$known_npc_list.some(n => n.id === _npc.id)>>
<<AddNPCWithFamily _npc>>
<<else>>
<<set _idx to $known_npc_list.findIndex(n => n.id === _npc.id)>>
<<set $known_npc_list[_idx].isMet to true>>
<<set $known_npc_list[_idx].isUnknown to false>>
<<run Object.assign($known_npc_list[_idx], _npc)>>
<</if>>
/* Refresh the page to show the new interaction menu */
<<run Engine.play(passage())>>
<</link>>
<<else>>
<!-- ========== NPC-INITIATED HARASSMENT (can escalate to forced sex) ========== -->
<<set _randomchance to random(1,100)>>
<<if _randomchance lt 20>>
<<set _npcWantsHarass to (
(_npc.depravity > 60) or
(["Wicked","Evil","Selfish"].includes(_npc.internalTrait)) or
(["Power-hungry","Self centered"].includes(_npc.externalTrait)) or
($corruption > 20 and _npc.depravity > 40)
)>>
<<if not _playerHarassedFlag and _npcWantsHarass>>
<<link "??? (something feels off)">>
<<set _playerHarassedFlag = true>>
<<set _roll to random(1,100)>>
<<set _baseChance to 40 + (_npc.depravity / 2) - ($corruption / 2) - ($charisma / 2)>>
<<set _chance to Math.max(10, Math.min(90, _baseChance))>>
<<set _text = "">>
<<set _friendshipChange = 0>>
<<set _corruptionChange = 0>>
<<set _npcDepravityChange = 0>>
<<set _forcedSex = false>>
<<if _roll lt _chance>>
<<set _harassType to random(1,6)>> <!-- 6 variants now -->
<<if _harassType eq 1>>
<img src="images/Sex/waistgrab.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} steps close, grabbing your waist with both hands. <span class="${_npc.gender}">"So tempting,"</span> they whisper, squeezing your ${_npc.gender eq "male" ? "hips" : "rear"} roughly.`>>
<<elseif _harassType eq 2>>
<img src="images/Sex/kissing.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} presses you against the wall, their lips crushing yours in a forceful kiss. Their tongue invades your mouth without consent.`>>
<<elseif _harassType eq 3>>
<img src="images/Sex/titgrab.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} pulls at your robes, exposing your shoulder. <span class="${_npc.gender}">"I've been wanting this for a while,"</span> they growl, groping your chest.`>>
<<elseif _harassType eq 4>>
<img src="images/Sex/thighgrab.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} slides a hand under your robes, fingers brushing against your inner thigh. <span class="${_npc.gender}">"Don't make a sound,"</span> they murmur.`>>
<<elseif _harassType eq 5>>
<img src="images/Sex/grinding.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} turns you around, pressing their body against yours, grinding their ${_npc.gender eq "male" ? "hardness" : "hips"} against you. <span class="${_npc.gender}">"You'll learn to enjoy this."</span>`>>
<<else>>
<img src="images/Sex/waistgrab1.webp" class="nsfw-glow">
<<set _text = `${_npc.fullname} grabs your wrist and pulls you close, their other hand groping your backside. <span class="${_npc.gender}">"What a delicious little cultivator."</span>`>>
<</if>>
<<set _friendshipChange = -15>>
<<set _npcDepravityChange = 5>>
<<set _corruptionChange = 3>>
<!-- Chance to escalate to forced sex if NPC is very depraved and not much weaker -->
<<if _npc.depravity > 51 and _npc.power >= $playerPower - 1>>
<<set _forceRoll = random(1,100)>>
<<if _forceRoll lt 30>>
<<set _forcedSex = true>>
<<set _text += ` Before you can react, they overpower you, dragging you into the shadows. <span class="${_npc.gender}">"I'll take what I want,"</span> they snarl.`>>
<<set _friendshipChange = -30>>
<<set _corruptionChange = 10>>
<<set _npcDepravityChange = 8>>
<</if>>
<</if>>
<<if $corruption > 60>>
<<set _text += ` Your body betrays you with a shiver of pleasure. They notice and smirk.`>>
<<set _friendshipChange = 0>>
<<set _corruptionChange = 8>>
<<elseif $corruption > 30>>
<<set _text += ` You manage to push them away, but your pulse races.`>>
<<else>>
<<set _text += ` You shove them back, face red with anger. <span class="player">"Get away!"</span>`>>
<</if>>
<<else>>
<<set _text = `${_npc.fullname} looks at you hungrily, but seems to reconsider. They step back, muttering <span class="${_npc.gender}">"Not now..."</span>`>>
<<set _friendshipChange = -5>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += _friendshipChange>>
<<set $known_npc_list[_i].depravity += _npcDepravityChange>>
<<break>>
<</if>>
<</for>>
<<set $corruption += _corruptionChange>>
<<if _forcedSex>>
<<set $sexPartner = _npc>>
<<set $sexType = "forced_npc">>
<<goto "EncounterInteractionSex">>
<<else>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<p><<print _text>></p>
<p class="cyan-text">✦ Friendship: <<if _friendshipChange gt 0>>+<</if>><<print _friendshipChange>> | Corruption: +<<print _corruptionChange>> | NPC depravity: +<<print _npcDepravityChange>> ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</if>>
<</link>>
<</if>>
<</if>>
<!-- ========== PLAYER AGGRESSIVE OPTIONS (unchanged except using power) ========== -->
<<if $corruption gt 30 and $playerPower gt _npc.power>>
<<link "Intimidate">>
<<set _roll to random(1,100)>>
<<set _chance to 40 + ($corruption / 2) + ($charisma / 2) - (_npc.depravity / 2)>>
<<set _friendshipChange = 0>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<<if _roll lt _chance>>
<<set _friendshipChange = -10>>
<<set $corruption += 2>>
<p>You flare your aura, letting your cultivation pressure bear down on <<print _npc.name>>. They pale, stammering apologies, hands trembling.</p>
<p class="warning-text">✦ Friendship decreased, corruption increased. ✦</p>
<<else>>
<<set _friendshipChange = 5>>
<p>You try to pressure them, but they refuse to yield, meeting your eyes with defiance.</p>
<p class="cyan-text">✦ They are not impressed. ✦</p>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += _friendshipChange>>
<<break>>
<</if>>
<</for>>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</link>>
<</if>>
<<if $corruption gt 40>>
<<link "Grope">>
<<set _roll to random(1,100)>>
<<set _chance to 40 + ($corruption / 2) + (($playerPower - _npc.power) * 10)>>
<<set _text = "">>
<<set _friendshipChange = 0>>
<<set _corruptionChange = 0>>
<<set _npcDepravityChange = 0>>
<<if _roll lt _chance>>
<<if _npc.gender eq "male">>
<<set _text = `You boldly run your hand down ${_npc.fullname}'s chest, fingers brushing over their hardening nipples. They gasp but don't pull away.`>>
<<else>>
<<set _text = `You reach around and cup ${_npc.fullname}'s ass, squeezing firmly. They inhale sharply but lean into your touch.`>>
<</if>>
<<set _friendshipChange = -5>>
<<set _corruptionChange = 4>>
<<set _npcDepravityChange = 3>>
<<if random(1,100) < _npc.depravity>>
<<set _text += ` Instead of resisting, they press against you, a hungry moan escaping their lips.`>>
<<set _friendshipChange = 2>>
<</if>>
<<else>>
<<set _text = `Your hand is slapped away. ${_npc.fullname}'s face twists in disgust. <span class="${_npc.gender}">"How dare you!"</span>`>>
<<set _friendshipChange = -15>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += _friendshipChange>>
<<set $known_npc_list[_i].depravity += _npcDepravityChange>>
<<break>>
<</if>>
<</for>>
<<set $corruption += _corruptionChange>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<p><<print _text>></p>
<p class="cyan-text">✦ Friendship: <<if _friendshipChange gt 0>>+<</if>><<print _friendshipChange>> | Corruption: +<<print _corruptionChange>> | NPC depravity: +<<print _npcDepravityChange>> ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</link>>
<</if>>
<<if $corruption gt 50>>
<<link "Make a bold move">>
<<set _roll to random(1,100)>>
<<set _chance to 30 + ($corruption / 2) + (($playerPower - _npc.power) * 10)>>
<<set _text = "">>
<<set _friendshipChange = 0>>
<<set _corruptionChange = 0>>
<<set _npcDepravityChange = 0>>
<<if _roll lt _chance>>
<<set _text = `You grab ${_npc.fullname} by the waist, pulling them close. Your lips brush their neck, teeth grazing skin. <span class="player">"Don't resist,"</span> you murmur. They shiver, yielding to you.`>>
<<set _friendshipChange = -5>>
<<set _corruptionChange = 6>>
<<set _npcDepravityChange = 4>>
<<set $sexPartner = _npc>>
<<set $sexType = "aggressive_player">>
<<goto "EncounterInteractionSex">>
<<else>>
<<set _text = `${_npc.fullname} pushes you away firmly. <span class="${_npc.gender}">"Enough! I'll not be toyed with."</span>`>>
<<set _friendshipChange = -15>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += _friendshipChange>>
<<set $known_npc_list[_i].depravity += _npcDepravityChange>>
<<break>>
<</if>>
<</for>>
<<set $corruption += _corruptionChange>>
<<if not (_roll lt _chance)>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<p><<print _text>></p>
<p class="cyan-text">✦ Friendship: <<if _friendshipChange gt 0>>+<</if>><<print _friendshipChange>> | Corruption: +<<print _corruptionChange>> | NPC depravity: +<<print _npcDepravityChange>> ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</if>>
<</link>>
<</if>>
<<if $corruption gt 70 and $playerPower gt (_npc.power + 1)>>
<<link "Overwhelm">>
<<set $maxArousal to 100>>
<<set _roll to random(1,100)>>
<<set _chance to 20 + ($corruption / 2) + ($charisma / 2) - (_npc.depravity / 2)>>
<<set _friendshipChange = 0>>
<<if _roll lt _chance>>
<<set $corruption += 12>>
<<set _friendshipChange = -40>>
<<set $sexPartner = _npc>>
<<set $sexType = "rape_player">>
<<GenerateGrudge _npc "rape">>
<<goto "EncounterInteractionSex">>
<<else>>
<<set _friendshipChange = -25>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<p>Your attempt to force them fails when they scream for help. You flee before guards arrive, but your reputation suffers.</p>
<p class="red-text">✦ The encounter ends badly. ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += _friendshipChange>>
<<set $known_npc_list[_i].depravity += 5>>
<<break>>
<</if>>
<</for>>
<</link>>
<</if>>
<!-- ========== CONSENSUAL SCENES ========== -->
<<link "Flirt">>
<<set _roll to random(1,100)>>
<<set _chance = 40 + ($charisma / 2) + ($corruption / 10) - (_npc.depravity / 5)>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<<if _roll lte _chance>>
<<set _gain to random(5,15)>>
<<set _npc.friendship += _gain>>
<<set $corruption += 1>>
<p>You exchange a few charged words. The mood shifts in your favor.</p>
<<if _npc.depravity > 50>>
<p><span class="${_npc.gender}">${_npc.fullname}</span> gives you a knowing smile. <span class="${_npc.gender}">"Perhaps we could find someplace quieter..."</span></p>
<<link "Accept the invitation">>
<<set $sexPartner = _npc>>
<<set $sexType = "consensual_flirt">>
<<goto "EncounterInteractionSex">>
<</link>>
<<else>>
<p class="gold-text">✦ Success! Friendship increased. ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
<</if>>
<<else>>
<<set _npc.friendship -= random(2,5)>>
<p>Your advance is politely rejected.</p>
<<link "Continue" $encounterOriginPassage>><</link>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship = _npc.friendship>>
<<set $known_npc_list[_i].depravity = _npc.depravity>>
<<break>>
<</if>>
<</for>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</link>>
<<if $corruption gt 50 and _npc.depravity gt 40>>
<<link "Seduce">>
<<set _roll to random(1,100)>>
<<set _chance = 30 + ($charisma / 2) + ($corruption / 2)>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<<if _roll lte _chance>>
<<set _npc.friendship += 25>>
<<set _npc.depravity += 10>>
<<set $corruption += 5>>
<p>You whisper promises in their ear, your hand slipping beneath their robes. They follow you eagerly to a private spot.</p>
<<link "Seize the moment">>
<<set $sexPartner = _npc>>
<<set $sexType = "consensual_seduce">>
<<goto "EncounterInteractionSex">>
<</link>>
<<else>>
<<set _npc.friendship -= 15>>
<p>They recoil in horror. <span class="${_npc.gender}">"Get away from me!"</span></p>
<p class="red-text">✦ Failure. ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
<</if>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship = _npc.friendship>>
<<set $known_npc_list[_i].depravity = _npc.depravity>>
<<break>>
<</if>>
<</for>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</link>>
<</if>>
<<link "Observe from afar">>
<<set $insight += 1>>
<<set _npc.friendship += 2>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id eq _npc.id>>
<<set $known_npc_list[_i].friendship += 2>>
<<break>>
<</if>>
<</for>>
<<replace "#interaction-result">>
<div class="result animate-fade-in">
<p>You watch <<print _npc.fullname>> from a distance and learn a little more about them.</p>
<p class="cyan-text">✦ Insight +1 | Friendship +2 ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#choice-container">><</replace>>
<</link>>
<<link "Back" $encounterOriginPassage>><</link>>
<</if>>
</div>
</div>
<</if>><<set _partner to $sexPartner>>
<<set _type to $sexType>>
<<set _returnPassage to $sexReturnPassage ?? $encounterOriginPassage>>
<<if not $maxArousal>>
<<set $maxArousal = 100>>
<</if>>
<div id="casualSexContainer">
<<if _type eq "forced_npc">>
<<CasualSex _partner "vengeance" "sub" "full" _returnPassage null _type>>
<<elseif _type eq "aggressive_player">>
<<CasualSex _partner "dominance" "dom" "full" _returnPassage null _type>>
<<elseif _type eq "rape_player">>
<<CasualSex _partner "cruelty" "dom" "full" _returnPassage null _type>>
<<elseif _type eq "consensual_flirt">>
<<CasualSex _partner "affection" "neutral" "full" _returnPassage null _type>>
<<elseif _type eq "consensual_seduce">>
<<CasualSex _partner "seduction" "neutral" "full" _returnPassage null _type>>
<<elseif _type eq "revenge_victory">>
<<CasualSex _partner "triumph" "dom" "full" _returnPassage null _type>>
<<elseif _type eq "revenge_loss">>
<<CasualSex _partner "humiliation" "sub" "full" _returnPassage null _type>>
<<elseif _type eq "brothel_hire">>
<<CasualSex _partner "pleasure" "neutral" "full" _returnPassage null _type>>
<<elseif _type eq "brothel_work">>
<<CasualSex _partner "service" "sub" "full" _returnPassage null _type>>
<<elseif _type eq "mission_sex">>
<<CasualSex _partner "duty" $missionDominance "full" _returnPassage null _type>>
<<else>>
<<CasualSex _partner "intimacy" "neutral" "full" _returnPassage null "casual">>
<</if>>
</div><<link "go back" "Map|Region1">><</link>>
<<if $pe eq 0>>
\<<CreateNPC_Region1>>\
You've met _fullname
<<set _currenthealthNPC to _maxhealthNPC>>
<<set _currentenergyNPC to _maxenergyNPC>>
_intTrait
_extTrait
_cultivation
_currenthealthNPC / _maxhealthNPC
_currentenergyNPC / _maxenergyNPC
<<BeforeBattle>>
<<link "Battle1" "Battle1">><<set $passage to "Battle1">><<set $pe=0>><</link>>
[[x->HpLowEncounter][$pe=1]]
<<elseif $pe eq 1>>
You are fighting <<print $currentEnemy.fullname>>
Cultivation: <<print $currentEnemy.realm>>
HP: <<print $currentEnemy.NPCcurrenthealth>> / <<print $currentEnemy.NPCmaxhealth>>
Energy: <<print $currentEnemy.NPCcurrentenergy>> / <<print $currentEnemy.NPCmaxenergy>>
[[x2->HpLowEncounter][$pe=2]]
<<elseif $pe eq 2>>
<<if $health lte 0>>
You've lost!
<<elseif $currentEnemy.NPCcurrenthealth lte 0>>
You've won!
Do you want to
<<link "Kill enemy" "HpLowEncounter">> <<set $pe to 3>><</link>>
<<link "Humiliate enemy" "HpLowEncounter">> <<set $pe to 4>><</link>>
<<link "Spare him" "HpLowEncounter">><<set $pe to 5>><</link>>
<<else>>
<<PlayerTurn>>
<<EnemyTurn>>
<</if>>
[[contine->HpLowEncounter][$pe=1]]
<<elseif $pe eq 3>>
You've killed $currentEnemy.fullname
You gained some of his items!
<<link "Continue" "Map|Region1">>
<<set $pe to 0>><</link>>
<<elseif $pe eq 4>>
$currentEnemy.fullname won't forget this humiliation! He may seek revenge later!
<<set $currentEnemy.friendship to -5>>
<<set $currentEnemy.relationshipType to "rival">>
<<link "Continue" "Map|Region1">> <<BattleAddNPC>> <<set $pe to 0>><</link>>
<<elseif $pe eq 5>>
$currentEnemy.fullname is gratefull for your action! He will remember this!
<<set $currentEnemy.friendship to 1>>
<<set $currentEnemy.relationshipType to "friend">>
<<link "Continue" "Map|Region1">> <<set $pe to 0>><<BattleAddNPC>> <</link>>
<</if>><<if $pe eq 0>>
<<set _grudge to $currentRevengeGrudge>>
<<set _avenger to $known_npc_list.find(function(n) { return n.id === _grudge.avengerId; })>>
/* Failsafe origin passage */
<<set $encounterOriginPassage to $encounterOriginPassage || "Map|Region1">>
<div class="encounter-interaction">
<h3>✦ A Shadow from the Past ✦</h3>
<div class="encounter-portrait-large">
<<if _avenger.enemyimage and _avenger.enemyregion>>
<img @src="'images/' + _avenger.enemyregion + '/' + _avenger.enemyimage + '.jpg'" width="80%">
<<else>>
<div class="portrait-placeholder">⚔️</div>
<</if>>
</div>
<div id="revenge-result" class="result">
<<if _grudge.type eq "rape">>
<p><span @class="_avenger.gender"><<print _avenger.fullname>></span> blocks your path, eyes burning with fury.</p>
<p><span @class="_avenger.gender">"You defiled <<print _grudge.victimName>>! The heavens may forgive, but I will not!"</span></p>
<<elseif _grudge.type eq "murder">>
<p><span @class="_avenger.gender"><<print _avenger.fullname>></span> steps forward, grief and rage twisting their features.</p>
<p><span @class="_avenger.gender">"You took <<print _grudge.victimName>> from this world. Prepare to face justice!"</span></p>
<<elseif _grudge.type eq "seduction">>
<p><span @class="_avenger.gender"><<print _avenger.fullname>></span> confronts you, jealousy burning in their eyes.</p>
<p><span @class="_avenger.gender">"You think you can toy with <<print _grudge.victimName>>'s heart and walk free?"</span></p>
<<else>>
<p><span @class="_avenger.gender"><<print _avenger.fullname>></span> stands before you, vengeance etched into every line of their face.</p>
<p><span @class="_avenger.gender">"For what you did to <<print _grudge.victimName>>, you will pay!"</span></p>
<</if>>
<<if _avenger.power gt $playerPower>>
<p class="warning-text">Their cultivation surpasses yours. This will be a difficult battle!</p>
<<elseif _avenger.power lt $playerPower>>
<p class="cyan-text">Their cultivation is weaker. Justice may be blind, but power is not.</p>
<</if>>
</div>
<div id="revenge-choices">
<<link "Fight">>
<<set $combatOpponent to _avenger>>
<<set $combatReason to "revenge_grudge">>
<<set $nextPe to 1>>
<<BeforeBattle _avenger>>
<<goto "Battle">>
<</link>>
<<if $charisma gt 30 and $corruption lt 50>>
<<link "Attempt to talk them down">>
<<set _roll to random(1,100)>>
<<set _chance to 20 + ($charisma / 2) + ($righteousreputation / 10) - (_grudge.severity * 3)>>
<<replace "#revenge-result">>
<div class="result animate-fade-in">
<<if _roll lt _chance>>
<p>You speak of regrets, of the cruelty of fate. <span @class="_avenger.gender"><<print _avenger.fullname>></span> hesitates, their anger wavering.</p>
<p><span @class="_avenger.gender">"...Leave. Before I change my mind."</span></p>
<<set $righteousreputation += 5>>
/* Remove the grudge */
<<set $activeGrudges.deleteAt($activeGrudges.findIndex(function(g) { return g.id === _grudge.id; }))>>
<br><<link "Leave" $encounterOriginPassage>><</link>>
<<else>>
<p>Your words ring hollow. <span @class="_avenger.gender">"Lies! You will face justice!"</span></p>
<br><<link "Fight">>
<<set $combatOpponent to _avenger>>
<<set $combatReason to "revenge_grudge">>
<<set $nextPe to 1>>
<<BeforeBattle _avenger>>
<<goto "Battle">>
<</link>>
<</if>>
</div>
<</replace>>
<<replace "#revenge-choices">><</replace>>
<</link>>
<</if>>
<<if $corruption gt 60 and $playerPower gt _avenger.power>>
<<link "Crush them utterly">>
<<replace "#revenge-result">>
<div class="result animate-fade-in">
<p>You laugh, unleashing your full cultivation. <span @class="_avenger.gender"><<print _avenger.fullname>></span> is crushed beneath your might.</p>
<p class="warning-text">✦ You have proven that power is the only justice. Your demonic reputation grows. ✦</p>
<<set $demonicreputation += 20>>
<<set $hypocrisyScore += 15>>
<<set _avenger.isDead = true>>
<<set _avenger.deathCause = "revenge_killed">>
<<set _avenger.killedByPlayer = true>>
<<set _avenger.killedInRevenge = true>>
<<set _avenger.deathGrudgeType = _grudge.type>>
<<set _avenger.deathGrudgeVictim = _grudge.victimName>>
<div class="warning-text">You have slain <<print _avenger.fullname>>, who sought vengeance for <<print _grudge.victimName>>.</div>
<<set $activeGrudges.deleteAt($activeGrudges.findIndex(function(g) { return g.id === _grudge.id; }))>>
<<LogEvent "combat" "Grudge Resolved" `"You have ended the life of " + _avenger.fullname + ", who sought retribution for " + _grudge.victimName + ". Their earthly resentment is extinguished; the cycle of vengeance ends here."` 4>> <p class="cyan-text">✦ The shadow that hunted you is no more. ✦</p>
<br><<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#revenge-choices">><</replace>>
<</link>>
<</if>>
<<if $sectFame gt 50 and $righteousreputation gt 30>>
<<link "Invoke your reputation">>
<<replace "#revenge-result">>
<div class="result animate-fade-in">
<p>You invoke your standing in the cultivation world. <span @class="_avenger.gender"><<print _avenger.fullname>></span> hesitates, aware of the consequences.</p>
<p><span @class="_avenger.gender">"...The sects protect their own. This is not over."</span></p>
/* Delayed, but triggered set to false so it can happen again! */
<<set _grudge.timer to random(20, 60)>>
<<set _grudge.triggered to false>>
<br><<link "Leave" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<<replace "#revenge-choices">><</replace>>
<</link>>
<</if>>
</div>
</div>
<<elseif $pe eq 1>>
<<set _grudge to $currentRevengeGrudge>>
<<set _avenger to $defeatedEnemy>>
<<set $encounterOriginPassage to $encounterOriginPassage || "Map|Region1">>
<div class="encounter-interaction">
<h3>✦ The Scales of Justice ✦</h3>
<div class="encounter-portrait-large">
<<if _avenger.enemyimage and _avenger.enemyregion>>
<img @src="'images/' + _avenger.enemyregion + '/' + _avenger.enemyimage + '.jpg'" width="80%">
<<else>>
<div class="portrait-placeholder">⚔️</div>
<</if>>
</div>
<div class="result">
<p>You have bested <span @class="_avenger.gender">_avenger.fullname</span> in combat. They lie at your feet, their vengeance shattered.</p>
<p>How do you resolve this?</p>
</div>
<div id="revenge-victory-choices">
<!-- Kill -->
<<link "Kill them">>
<<replace "#revenge-victory-choices">>
<div class="result">
<p>You raise your weapon and end their life. Their eyes meet yours one last time, filled with hate and despair, before the light fades.</p>
<p>As their qi scatters, you feel the weight of another death added to your conscience.</p>
<<set _avenger.isDead = true>>
<<set _avenger.deathCause = "revenge_killed">>
<<set _avenger.killedByPlayer = true>>
<<set _avenger.killedInRevenge = true>>
<<set _avenger.deathGrudgeType = _grudge.type>>
<<set _avenger.deathGrudgeVictim = _grudge.victimName>>
<<set $activeGrudges.deleteAt($activeGrudges.findIndex(function(g) { return g.id === _grudge.id; }))>>
<<set $demonicreputation += 5>>
<<set $fame += 5>>
<<set $corruption = Math.min(100, $corruption + 3)>>
<<LogEvent "combat" "Grudge Resolved" `"You have ended the life of " + _avenger.fullname + ", who sought retribution for " + _grudge.victimName + ". Their earthly resentment is extinguished; the cycle of vengeance ends here."` 4>> <p class="cyan-text">✦ The shadow that hunted you is no more. ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<</link>>
<!-- Spare (mercy) -->
<<link "Spare their life">>
<<replace "#revenge-victory-choices">>
<div class="result">
<p>You lower your weapon. <span class="player">"Go. Your vengeance is futile."</span></p>
<p><span @class="_avenger.gender">_avenger.fullname</span> stares at you, disbelief warring with shame. They stagger to their feet.</p>
<<if _grudge.type eq "rape">>
<p><span @class="_avenger.gender">“You... you think this absolves you?”</span> they spit, but the fire in their eyes is dim.</p>
<<elseif _grudge.type eq "murder">>
<p><span @class="_avenger.gender">“Mercy? You took a life! This changes nothing!” they rasp, but they stumble away.</p>
<<else>>
<p><span @class="_avenger.gender">“This isn't over...”</span> they whisper, but their voice lacks conviction.</p>
<</if>>
<p>They retreat, humbled but not broken. The grudge may fade, or it may smoulder for years.</p>
<<set _grudge.severity = Math.max(1, _grudge.severity - 3)>>
<<set _grudge.timer = random(20, 60)>>
<<set _grudge.triggered = false>>
<<set $righteousreputation += 5>>
<<set $corruption = Math.max(0, $corruption - 2)>>
<p class="cyan-text">✦ Their grudge still simmers, but it may take a long time to reignite. ✦</p>
<<link "Continue" $encounterOriginPassage>><</link>>
</div>
<</replace>>
<</link>>
<!-- Humiliate / NSFW Spare (if avenger depraved or grudge type sexual) -->
<<if $corruption gte 60>>
<<link "Claim them as your prize" "EncounterInteractionSex">>
<<set $sexPartner = _avenger>>
<<set $sexType = "revenge_victory">>
<<set $sexReturnPassage = $encounterOriginPassage>>
<<set $activeGrudges.deleteAt($activeGrudges.findIndex(function(g) { return g.id === _grudge.id; }))>>
<<set $corruption = Math.min(100, $corruption + 8)>>
<<set $demonicreputation += 10>>
<</link>>
<</if>>
</div>
</div>
<<elseif $pe eq 2>>
<<set _grudge to $currentRevengeGrudge>>
<<set _avenger to $known_npc_list.find(function(n) { return n.id === _grudge.avengerId; })>>
<<set $encounterOriginPassage to $encounterOriginPassage || "Map|Region1">>
<<set _nsfwLoss = false>>
<div class="encounter-interaction">
<h3>✦ The Debt of Blood ✦</h3>
<div class="encounter-portrait-large">
<<if _avenger.enemyimage and _avenger.enemyregion>>
<img @src="'images/' + _avenger.enemyregion + '/' + _avenger.enemyimage + '.jpg'" width="80%">
<<else>>
<div class="portrait-placeholder">⚔️</div>
<</if>>
</div>
<div class="result">
<<if $playerLost>>
<p>You have been bested. <span class="${_avenger.gender}">${_avenger.fullname}</span> stands over you, their blade at your throat, their eyes blazing with righteous fury.</p>
/* Check for NSFW loss possibility */
<<if _avenger.depravity > 60 and ( _grudge.type eq "rape" or _grudge.type eq "seduction" )>>
<<set _nsfwLoss = true>>
<p>A dark gleam enters their eyes. <span @class="_avenger.gender">"Death would be too merciful,"</span> they murmur. <span @class="_avenger.gender">"Perhaps you need to learn what you've done... firsthand."</span></p>
<<set $sexPartner = _avenger>>
<<set $sexType = "revenge_loss">>
<<set $sexReturnPassage = $encounterOriginPassage>>
<<link "Submit">>
<<goto "EncounterInteractionSex">>
<</link>>
<<elseif _avenger.depravity > 70 or ["Wicked","Evil","Power-hungry"].includes(_avenger.internalTrait) or ["Power-hungry","Self centered"].includes(_avenger.externalTrait)>>
<<set _nsfwLoss = true>>
<p>They sheathe their weapon, a cruel smile playing on their lips. <span @class="_avenger.gender">"There are worse fates than death,"</span> they say. <span @class="_avenger.gender">"You will repay your debt... with your body."</span></p>
<<set $sexPartner = _avenger>>
<<set $sexType = "revenge_loss">>
<<set $sexReturnPassage = $encounterOriginPassage>>
<<link "Submit">>
<<goto "EncounterInteractionSex">>
<</link>>
<</if>>
<<if not _nsfwLoss>>
<<if _grudge.type eq "rape">>
<p><span @class="_avenger.gender">“Now you know how it feels to be powerless,”</span> they snarl. <span @class="_avenger.gender">“For what you did to <span class="${_avenger.gender}">${_grudge.victimName}</span>, I should end you here. But death is too kind.”</span></p>
<p>They leave you broken and humiliated, a mark of your shame forever carved into your reputation.</p>
<<set $demonicreputation += 5>>
<<set $publicReputation -= 10>>
<<set $health = Math.floor($health * 0.5)>>
<<set $corruption = Math.min(100, $corruption + 3)>>
<<LogEvent "reputation" "Public Shaming" "You were defeated by " + _avenger.fullname + ", who sought revenge for " + _grudge.victimName + ". Your reputation suffered." 3>>
<<elseif _grudge.type eq "murder">>
<p><span @class="_avenger.gender">“You took a life. Now you owe a life.”</span> The blade presses deeper, drawing blood. <span @class="_avenger.gender">“But the heavens are watching. Live with your guilt.”</span></p>
<p>They leave you bleeding, but alive – perhaps to let the weight of your crime crush you slowly.</p>
<<set $demonicreputation += 10>>
<<set $publicReputation -= 15>>
<<set $health = Math.floor($health * 0.6)>>
<<set $hypocrisyScore += 8>>
<<LogEvent "combat" "Grudge Defeat" "You were defeated by " + _avenger.fullname + ", avenging " + _grudge.victimName + ". Your shame echoes in the Jianghu." 4>>
<<else>>
<p><span @class="_avenger.gender">“This is your punishment,”</span> they say coldly. <span @class="_avenger.gender">“Let the world know what you've done. Let your shame be your cage.”</span></p>
<p>They walk away, leaving you to crawl back to the world, your pride in tatters.</p>
<<set $fame -= 5>>
<<set $publicReputation -= 5>>
<<set $health = Math.floor($health * 0.7)>>
<<LogEvent "reputation" "Defeated by Rival" "You were bested by " + _avenger.fullname + ", who sought justice for " + _grudge.victimName + "." 3>>
<</if>>
/* Grudge persists or intensifies */
<<set _grudge.severity = Math.min(10, _grudge.severity + 2)>>
<<set _grudge.timer = random(15, 45)>>
<<set _grudge.triggered = false>>
<p class="warning-text">✦ Their grudge has deepened. They will surely seek you out again. ✦</p>
<</if>>
<</if>>
<<if not _nsfwLoss>>
<<link "Return, wounded" $encounterOriginPassage>><</link>>
<</if>>
</div>
</div>
<</if>><<set $itemList to []>>
<<set $itemList.push($bloodhardeningherb)>>
<<set $itemList.push($sturdygrassfiber)>>
<<set $itemList.push($ironbloodlotusseed)>>
<<set $itemList.push($vitalityroot)>>
<<set $itemList.push($spiritvinetendril)>>
<<set $itemList.push($thunderweed)>>
<<set $itemList.push($nineleaflotus)>>
<<set $itemList.push($flowrootessence)>>
<<set $vitalityelixirrecipe to {
"name": "Vitality Elixir",
"bloodhardeningherb": 1,
"vitalityroot": 2,
"result": {
"id": "vitalityelixir",
"name": "Vitality Elixir",
"description": "Restores vitality and inner balance.",
"effect": "restoreHealth",
"quantity": 1,
"class": "potion"
}
}>><div class="elixir-pouch-container">
<div class="inventory-header">
<h2>Your Elixir Pouch</h2>
<p>Precious pills and spiritual elixirs gathered on your path to immortality.</p>
</div>
<div id="log"></div>
<<if $playerpotioninventory.length gt 0>>
<table class="elixir-inventory-table">
<thead>
<tr>
<th style="width: 80px;"></th>
<th>Elixir</th>
<th style="width: 100px; text-align: center;">Grade</th>
<th style="width: 100px; text-align: center;">Quantity</th>
<th style="width: 120px; text-align: center;">Action</th>
</tr>
</thead>
<tbody>
<<for _potion range $playerpotioninventory>>
<<set _rarityColor to
(_potion.grade <= 1 ? "#4fc3f7" :
_potion.grade <= 3 ? "#66bb6a" :
_potion.grade <= 5 ? "#ffa726" :
"#ab47bc") >> <!-- Blue → Green → Orange → Purple -->
<tr class="elixir-row">
<td style="text-align: center;">
<div class="elixir-icon">丹</div> <!-- Replace with <img src="your-icon-url.png"> later -->
</td>
<td>
<div class="item-name" style="color: <<print _rarityColor>>;"><<print _potion.name>></div>
<<if _potion.description neq null>>
<div class="item-desc"><<print _potion.description>></div>
<</if>>
</td>
<td style="text-align: center; color: <<print _rarityColor>>; font-weight: bold;">
Grade <<print _potion.grade>>
</td>
<td style="text-align: center;">
<div class="quantity-glow"><<print _potion.quantity>></div>
</td>
<td style="text-align: center;">
<<link "Consume">>
<<set $selectedPotion to _potion>>
<<if _potion.quantity lte 0>>
<<set $playerpotioninventory.deleteAt($playerpotioninventory.indexOf(_potion))>>
<</if>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text">Spiritual qi surges!</span><br>
You consume the <<print _potion.name>>. A warm current flows through your meridians...
</div>
<</replace>>
<<useItem>> <!-- Apply your custom effect macro here -->
<</link>>
</td>
</tr>
<</for>>
</tbody>
</table>
<<else>>
<div class="empty-pouch">
<p>Your elixir pouch is empty.</p>
<p>Seek out rare spirit-herbs and profound catalysts to sustain your journey toward immortality.</p>
</div>
<</if>>
<div id="use-log" class="log-area"></div>
</div>
<</if>>
<</nobr>><<set $strengthboostrecipe1 to {
"name": "Strength Boost Pill (Grade 1)",
"ingredients": {
"Tempered Bone Fragment": 1,
"Blood Hardening Herb": 2
},
"result": $strengthboostpotion1
}>><<set $strengthboostpotion1 to {
"id": "strengthboostpotion1",
"name": "Strength Boost Pill (Grade 1)",
"description": "Temporarily boosts strength. Grade 1 effective up to STR 15.",
"effect": "boostStrength",
"grade": 1,
"maxStatLimit": 15,
"quantity": 1,
"class": "potion",
"price": 150,
"sellprice": 60,
"tag": "Strength"
}>>
<<set $corruptionelixir to {
"id": "corruptionelixir",
"name": "Heart Demon Nectar",
"description": "Sweet demonic essence that loosens moral restraints and awakens hidden desires. Slightly increases demonic path affinity.",
"effect": "raiseCorruption",
"grade": 2,
"maxStatLimit": 0,
"quantity": 1,
"class": "potion",
"price": 300,
"sellprice": 75,
"tag": "Corruption"
}>>
<<set $succubusbreath to {
"id": "succubusbreath",
"name": "Succubus Breath Mist",
"description": "Inhaled vapors that temporarily heighten charm and make your voice more seductive. Others find it hard to refuse you.",
"effect": "boostCharisma",
"grade": 1,
"maxStatLimit": 20,
"quantity": 1,
"class": "potion",
"price": 250,
"sellprice": 62,
"tag": "Charisma"
}>>
<<set $forbiddenyangseed to {
"id": "forbiddenyangseed",
"name": "Forbidden Yang Seed",
"description": "A single drop of concentrated yang essence. Greatly increases corruption and demonic tendencies over time.",
"effect": "deepCorruption",
"grade": 3,
"maxStatLimit": 0,
"quantity": 1,
"class": "potion",
"price": 500,
"sellprice": 125,
"tag": "Corruption"
}>><<BackgroundHandler>>
You carefully kneel and begin collecting the herbs, taking care not to damage their roots.
Their scent is invigorating, and you can already imagine the pills or elixirs they might produce.
<<gainRandomItem>>
You've found <<print _item.name>>!
<<return "Go back">><<set $temperedbonefragment to {"name": "Tempered Bone Fragment", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 40, "tripleprice": 120, "sellprice": 12, "class": "item", "quantity": 0, "description": "Beast bone used to toughen the body.", "id": "temperedbonefragment"}>>
<<set $bodyforgingelixir to {"name": "Body Forging Elixir", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 50, "tripleprice": 150, "sellprice": 15, "class": "item", "quantity": 0, "description": "Strengthens muscles during training.", "id": "bodyforgingelixir"}>>
<<set $copperskinpowder to {"name": "Copper Skin Powder", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 45, "tripleprice": 135, "sellprice": 13, "class": "item", "quantity": 0, "description": "Boosts external durability for beginners.", "id": "copperskinpowder"}>>
<<set $bloodhardeningherb to {"name": "Blood Hardening Herb", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 55, "tripleprice": 165, "sellprice": 16, "class": "item", "quantity": 0, "description": "Thickens blood, reinforcing organs.", "id": "bloodhardeningherb"}>>
<<set $sturdygrassfiber to {"name": "Sturdy Grass Fiber", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 35, "tripleprice": 105, "sellprice": 10, "class": "item", "quantity": 0, "description": "Used in martial body rituals.", "id": "sturdygrassfiber"}>>
<<set $ironbloodlotusseed to {"name": "Ironblood Lotus Seed", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 90, "tripleprice": 270, "sellprice": 27, "class": "item", "quantity": 0, "description": "A seed that fortifies bone and blood.", "id": "ironbloodlotusseed"}>>
<<set $mountainoxtendon to {"name": "Mountain Ox Tendon", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 100, "tripleprice": 300, "sellprice": 30, "class": "item", "quantity": 0, "description": "Contains essence to improve muscle density.", "id": "mountainoxtendon"}>>
<<set $crimsonhideflake to {"name": "Crimson Hide Flake", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 85, "tripleprice": 255, "sellprice": 25, "class": "item", "quantity": 0, "description": "From beasts known for tough hides.", "id": "crimsonhideflake"}>>
<<set $vitalityroot to {"name": "Vitality Root", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 95, "tripleprice": 285, "sellprice": 28, "class": "item", "quantity": 0, "description": "Improves endurance and physical resilience.", "id": "vitalityroot"}>>
<<set $burningsandresin to {"name": "Burning Sand Resin", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 80, "tripleprice": 240, "sellprice": 24, "class": "item", "quantity": 0, "description": "Mixed into pills for body forging.", "id": "burningsandresin"}>>
<<set $dragonbonedust to {"name": "Dragonbone Dust", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 45, "class": "item", "quantity": 0, "description": "Legendary dust said to make skin unbreakable.", "id": "dragonbonedust"}>>
<<set $moltengolddew to {"name": "Molten Gold Dew", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 400, "tripleprice": 1200, "sellprice": 360, "class": "item", "quantity": 0, "description": "Rare liquid said to rebuild the body.", "id": "moltengolddew"}>>
<<set $titanapehair to {"name": "Titan Ape Hair", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 155, "tripleprice": 465, "sellprice": 46, "class": "item", "quantity": 0, "description": "Imbues user with great physical strength.", "id": "titanapehair"}>>
<<set $heavenlyemberflower to {"name": "Heavenly Ember Flower", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 165, "tripleprice": 495, "sellprice": 49, "class": "item", "quantity": 0, "description": "Used in heavenly-grade body pills.", "id": "heavenlyemberflower"}>>
<<set $phoenixbloodflake to {"name": "Phoenix Blood Flake", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 170, "tripleprice": 510, "sellprice": 51, "class": "item", "quantity": 0, "description": "Reshapes mortal frame to near-divine.", "id": "phoenixbloodflake"}>>
<<set $spiritvinetendril to {"name": "Spirit Vine Tendril", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 45, "tripleprice": 135, "sellprice": 13, "class": "item", "quantity": 0, "description": "Mildly stimulates meridian activity.", "id": "spiritvinetendril"}>>
<<set $qispunsilk to {"name": "Qi-Spun Silk", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 40, "tripleprice": 120, "sellprice": 12, "class": "item", "quantity": 0, "description": "Enhances energy circulation slightly.", "id": "qispunsilk"}>>
<<set $stonepulsepebble to {"name": "Stone Pulse Pebble", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 50, "tripleprice": 150, "sellprice": 15, "class": "item", "quantity": 0, "description": "Used in meditative formations.", "id": "stonepulsepebble"}>>
<<set $clearwaterextract to {"name": "Clearwater Extract", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 55, "tripleprice": 165, "sellprice": 16, "class": "item", "quantity": 0, "description": "Flushes impurities from meridians.", "id": "clearwaterextract"}>>
<<set $lessermeridiandust to {"name": "Lesser Meridian Dust", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 35, "tripleprice": 105, "sellprice": 10, "class": "item", "quantity": 0, "description": "Base material for opening pill recipes.", "id": "lessermeridiandust"}>>
<<set $brightmeridiancrystal to {"name": "Bright Meridian Crystal", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 95, "tripleprice": 285, "sellprice": 28, "class": "item", "quantity": 0, "description": "Directly enhances inner flow.", "id": "brightmeridiancrystal"}>>
<<set $serpentpulsesalve to {"name": "Serpent Pulse Salve", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 90, "tripleprice": 270, "sellprice": 27, "class": "item", "quantity": 0, "description": "Used to ease meridian blockages.", "id": "serpentpulsesalve"}>>
<<set $thunderweed to {"name": "Thunderweed", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 85, "tripleprice": 255, "sellprice": 25, "class": "item", "quantity": 0, "description": "Stimulates qi flow violently.", "id": "thunderweed"}>>
<<set $moonlightshell to {"name": "Moonlight Shell", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 100, "tripleprice": 300, "sellprice": 30, "class": "item", "quantity": 0, "description": "Cools and soothes energy pathways.", "id": "moonlightshell"}>>
<<set $nineleaflotus to {"name": "Nineleaf Lotus", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 105, "tripleprice": 315, "sellprice": 31, "class": "item", "quantity": 0, "description": "Refines and strengthens core meridians.", "id": "nineleaflotus"}>>
<<set $divinepulsestone to {"name": "Divine Pulse Stone", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 160, "tripleprice": 480, "sellprice": 48, "class": "item", "quantity": 0, "description": "Used by ancient sects for breakthroughs.", "id": "divinepulsestone"}>>
<<set $astraldewdrop to {"name": "Astral Dewdrop", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 170, "tripleprice": 510, "sellprice": 51, "class": "item", "quantity": 0, "description": "Mythical water for meridian clarity.", "id": "astraldewdrop"}>>
<<set $qidragonpearl to {"name": "Qi Dragon Pearl", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 175, "tripleprice": 525, "sellprice": 52, "class": "item", "quantity": 0, "description": "Enhances all internal channels.", "id": "qidragonpearl"}>>
<<set $voidmeridiancore to {"name": "Void Meridian Core", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 165, "tripleprice": 495, "sellprice": 49, "class": "item", "quantity": 0, "description": "Said to awaken even dormant talents.", "id": "voidmeridiancore"}>>
<<set $sunheartbark to {"name": "Sunheart Bark", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 155, "tripleprice": 465, "sellprice": 46, "class": "item", "quantity": 0, "description": "Generates warmth that spreads through body.", "id": "sunheartbark"}>>
<<set $faintqicrystal to {"name": "Faint Qi Crystal", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 50, "tripleprice": 150, "sellprice": 15, "class": "item", "quantity": 0, "description": "Can be absorbed by beginners.", "id": "faintqicrystal"}>>
<<set $meditationdust to {"name": "Meditation Dust", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 45, "tripleprice": 135, "sellprice": 13, "class": "item", "quantity": 0, "description": "Improves focus during breakthrough.", "id": "meditationdust"}>>
<<set $refinedspiritwater to {"name": "Refined Spirit Water", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 55, "tripleprice": 165, "sellprice": 16, "class": "item", "quantity": 0, "description": "Helps stabilize internal energy.", "id": "refinedspiritwater"}>>
<<set $crackedflowcharm to {"name": "Cracked Flow Charm", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 40, "tripleprice": 120, "sellprice": 12, "class": "item", "quantity": 0, "description": "Still carries usable qi patterns.", "id": "crackedflowcharm"}>>
<<set $risingmistherb to {"name": "Rising Mist Herb", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 35, "tripleprice": 105, "sellprice": 10, "class": "item", "quantity": 0, "description": "Mildly enhances energy cohesion.", "id": "risingmistherb"}>>
<<set $condensedqistone to {"name": "Condensed Qi Stone", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 95, "tripleprice": 285, "sellprice": 28, "class": "item", "quantity": 0, "description": "Holds stable, purified energy.", "id": "condensedqistone"}>>
<<set $jadegatheringthread to {"name": "Jade Gathering Thread", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 100, "tripleprice": 300, "sellprice": 30, "class": "item", "quantity": 0, "description": "Conducts energy smoothly during training.", "id": "jadegatheringthread"}>>
<<set $flowrootessence to {"name": "Flowroot Essence", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 90, "tripleprice": 270, "sellprice": 27, "class": "item", "quantity": 0, "description": "Draws external energy inward.", "id": "flowrootessence"}>>
<<set $innerflamecore to {"name": "Inner Flame Core", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 85, "tripleprice": 255, "sellprice": 25, "class": "item", "quantity": 0, "description": "Improves inner condensation quality.", "id": "innerflamecore"}>>
<<set $windveinpowder to {"name": "Wind Vein Powder", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 105, "tripleprice": 315, "sellprice": 31, "class": "item", "quantity": 0, "description": "Boosts spiraling qi motion.", "id": "windveinpowder"}>>
<<set $voidstormtear to {"name": "Voidstorm Tear", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 180, "tripleprice": 540, "sellprice": 54, "class": "item", "quantity": 0, "description": "Used to condense divine-quality qi.", "id": "voidstormtear"}>>
<<set $celestialcorecrystal to {"name": "Celestial Core Crystal", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 190, "tripleprice": 570, "sellprice": 57, "class": "item", "quantity": 0, "description": "Pulsates with raw elemental energy.", "id": "celestialcorecrystal"}>>
<<set $heavendrawingink to {"name": "Heaven-Drawing Ink", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 170, "tripleprice": 510, "sellprice": 51, "class": "item", "quantity": 0, "description": "Used in inscriptions to reshape qi.", "id": "heavendrawingink"}>>
<<set $originqiflake to {"name": "Origin Qi Flake", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 175, "tripleprice": 525, "sellprice": 52, "class": "item", "quantity": 0, "description": "Contains untouched universal energy.", "id": "originqiflake"}>>
<<set $truemistheart to {"name": "True Mist Heart", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 185, "tripleprice": 555, "sellprice": 55, "class": "item", "quantity": 0, "description": "Condenses all surrounding energies into user.", "id": "truemistheart"}>>
<<set $riverpearlscale to {
"name": "River Pearl Scale",
"strength": 0,
"agility": 0,
"willpower": 2,
"armor": 5,
"health": 0,
"energy": 0,
"evadescore": 0,
"price": 120,
"tripleprice": 360,
"sellprice": 36,
"class": "item",
"quantity": 0,
"description": "A shimmering, iridescent scale that provides a calming aura of the tides.",
"id": "riverpearlscale"
}>>
<<set $serpentmarkscale to {
"name": "Serpent Mark Scale",
"strength": 0,
"agility": 3,
"willpower": 0,
"armor": 3,
"health": 0,
"energy": 0,
"evadescore": 5,
"price": 150,
"tripleprice": 450,
"sellprice": 45,
"class": "item",
"quantity": 0,
"description": "A dark scale engraved with natural markings; it feels strangely light and flexible.",
"id": "serpentmarkscale"
}>><<link "Go back" $passage>><<unset $itemPage, $potionPage>><</link>>
<<nobr>>
/* Initialize variables */
<<set $pe to $pe ?? 0>>
<<set $itemPage to $itemPage ?? 1>>
<<set $potionPage to $potionPage ?? 1>>
<<set _limit to 5>>
<div class="tab-nav">
<<link "Items">>
<<set $pe to 0>>
<<goto "Inventory">>
<</link>>
<<link "Potions">>
<<set $pe to 1>>
<<goto "Inventory">>
<</link>>
</div>
<<if $pe eq 0>>
<div class="spatial-ring-container">
<div class="inventory-header">
<h2>Your Spatial Ring</h2>
<p>Treasures and materials harvested from the myriad realms, stored within this ancient spatial artifact.</p>
</div>
<div class="wealth-display">
<div class="gold-icon">灵</div>
<div class="gold-amount"><<print $gold>> Spirit Stones</div>
</div>
<<if $playeriteminventory.length gt 0>>
/* Pagination Logic for Items */
<<set _maxItemPages to Math.ceil($playeriteminventory.length / _limit)>>
<<set _itemStart to ($itemPage - 1) * _limit>>
<<set _displayItems to $playeriteminventory.slice(_itemStart, _itemStart + _limit)>>
<table class="item-inventory-table">
<thead>
<tr>
<th style="width: 80px;"></th>
<th>Item</th>
<th style="width: 120px; text-align: center;">Quantity</th>
</tr>
</thead>
<tbody>
<<for _item range _displayItems>>
<tr class="item-row">
<td style="text-align: center;"><div class="item-icon">宝</div></td>
<td>
<div class="item-name"><<print _item.name>></div>
<<if _item.description neq null>>
<div class="item-desc"><<print _item.description>></div>
<</if>>
</td>
<td style="text-align: center;"><div class="quantity-glow"><<print _item.quantity>></div></td>
</tr>
<</for>>
</tbody>
</table>
/* Item Pagination Controls */
<div class="pagination-controls" style="text-align:center; margin-top:10px;">
<<if $itemPage gt 1>>
<<link "« Prev">>
<<set $itemPage -= 1>>
<<goto "Inventory">>
<</link>>
<<else>>
<span style="opacity:0.5">« Prev</span>
<</if>>
<span style="margin: 0 15px;">Page $itemPage of _maxItemPages</span>
<<if $itemPage lt _maxItemPages>>
<<link "Next »">>
<<set $itemPage += 1>>
<<goto "Inventory">>
<</link>>
<<else>>
<span style="opacity:0.5">Next »</span>
<</if>>
</div>
<<else>>
<div class="empty-ring">
<p>Your spatial ring is empty.</p>
</div>
<</if>>
</div>
<<elseif $pe eq 1>>
<div class="elixir-pouch-container">
<div class="inventory-header">
<h2>Your Elixir Pouch</h2>
<p>Precious pills and spiritual elixirs gathered on your path to immortality.</p>
</div>
<div id="log"></div>
<<if $playerpotioninventory.length gt 0>>
/* Pagination Logic for Potions */
<<set _maxPotionPages to Math.ceil($playerpotioninventory.length / _limit)>>
<<set _potionStart to ($potionPage - 1) * _limit>>
<<set _displayPotions to $playerpotioninventory.slice(_potionStart, _potionStart + _limit)>>
<table class="elixir-inventory-table">
<thead>
<tr>
<th style="width: 80px;"></th>
<th>Elixir</th>
<th style="width: 100px; text-align: center;">Grade</th>
<th style="width: 100px; text-align: center;">Quantity</th>
<th style="width: 120px; text-align: center;">Action</th>
</tr>
</thead>
<tbody>
<<for _potion range _displayPotions>>
<<set _rarityColor to (_potion.grade <= 1 ? "#4fc3f7" : _potion.grade <= 3 ? "#66bb6a" : _potion.grade <= 5 ? "#ffa726" : "#ab47bc")>>
<tr class="elixir-row">
<td style="text-align: center;"><div class="elixir-icon">丹</div></td>
<td>
<div class="item-name" style="color: <<print _rarityColor>>;"><<print _potion.name>></div>
<<if _potion.description neq null>>
<div class="item-desc"><<print _potion.description>></div>
<</if>>
</td>
<td style="text-align: center; color: <<print _rarityColor>>; font-weight: bold;">Grade <<print _potion.grade>></td>
<td style="text-align: center;"><div class="quantity-glow"><<print _potion.quantity>></div></td>
<td style="text-align: center;">
<<link "Consume">>
<<set $selectedPotion to _potion>>
<<useItem>>
/* Check for removal after use */
<<if _potion.quantity lte 0>>
<<set $playerpotioninventory.deleteAt($playerpotioninventory.indexOf(_potion))>>
<</if>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text">Spiritual qi surges!</span><br>
You consume the <<print _potion.name>>.
</div>
<</replace>>
<</link>>
</td>
</tr>
<</for>>
</tbody>
</table>
/* Potion Pagination Controls */
<div class="pagination-controls" style="text-align:center; margin-top:10px;">
<<if $potionPage gt 1>>
<<link "« Prev">>
<<set $potionPage -= 1>>
<<goto "Inventory">>
<</link>>
<<else>>
<span style="opacity:0.5">« Prev</span>
<</if>>
<span style="margin: 0 15px;">Page $potionPage of _maxPotionPages</span>
<<if $potionPage lt _maxPotionPages>>
<<link "Next »">>
<<set $potionPage += 1>>
<<goto "Inventory">>
<</link>>
<<else>>
<span style="opacity:0.5">Next »</span>
<</if>>
</div>
<<else>>
<div class="empty-pouch">
<p>Your elixir pouch is empty.</p>
</div>
<</if>>
<div id="use-log" class="log-area"></div>
</div>
<</if>>
<</nobr>>
<div class="tab-nav">
<<link "Status">><<goto "Status">><</link>> <<link "Skills">><<goto "Skills">><</link>> <<link "Inventory">><<goto "Inventory">><</link>> <<link "Relations">><<goto "Relations">><</link>> <<link "Breakthrough">><<goto "Breakthrough">><</link>> <<link "Help">><<goto "Help">><</link>>
</div><<set $jadeprobe to {
id: "jadeprobe",
name: "Jade Meridian Probe",
description: "A thick, perfectly smooth jade dildo carved to stimulate deep internal meridians. Warms and pulses with channeled qi — designed for intense solo masturbation and yin essence refinement.",
price: 280,
sellprice: 70,
class: "toy",
lewd: true,
effect: "soloPenetration"
}>>
<<set $phoenixfeatherplug to {
id: "phoenixfeatherplug",
name: "Phoenix Feather Anal Plug",
description: "Tapered jade plug with soft phoenix feather tail. Inserted anally, it sends waves of warm yang fire through rear meridians - perfect for prolonged anal masturbation and forbidden pleasure cultivation.",
price: 320,
sellprice: 80,
class: "toy",
lewd: true,
effect: "analPlay"
}>>
<<set $lotusbeads to {
id: "lotusbeads",
name: "Lotus Prayer Beads",
description: "String of graduated rose quartz beads for progressive anal or vaginal insertion. Each bead vibrates with yin qi when pulled - ideal for extended masturbation sessions and meridian stretching.",
price: 350,
sellprice: 90,
class: "toy",
lewd: true,
effect: "beadInsertion"
}>>
<<set $merchantInventory to []>>
<<set $mysteriouspillforgeInventory to []>>
<<set $thunderclapswordforgeInventory to []>>
<<set $blissfurnacepavilionInventory to []>>
<<set $mysteriouspillforgeInventory.push($strengthboostpotion1)>>
<<set $thunderclapswordforgeInventory.push($crimsonlotussword, $jadewhip, $phoenixfan
)>>
<<set $blissfurnacepavilionInventory.push($corruptionelixir, $succubusbreath, $forbiddenyangseed
)>>
<!-- Wandering merchants -->
<<set $wanderingMerchantInventory to []>>
<<set $wanderingMerchantInventory.push($copperskinpowder, $crimsonhideflake, $burningsandresin, $titanapehair, $spiritvinetendril)>>/* NPC stat table */
<<widget "BookOfConnections_npcStats">>
<<if !$currentNPC.isDead>>
<div class="stat-table-container">
<table class="stat-table">
<tr>
<th>General</th>
<th>Combat</th>
</tr>
<tr>
<td>
<b>🧬 Lifespan:</b> <<print $currentNPC.NPClifespan>> / <<print $currentNPC.NPCmaxlifespan>><br>
<b>❤️ Health:</b> <<print $currentNPC.NPCcurrenthealth>> / <<print $currentNPC.NPCmaxhealth>><br>
<b>⚡ Energy:</b> <<print $currentNPC.NPCcurrentenergy>> / <<print $currentNPC.NPCmaxenergy>><br>
<b>🍀 Luck:</b> <<print $currentNPC.NPCluck>><br>
<b>🧠 Insight:</b> <<print $currentNPC.NPCinsight>><br>
<b>💪 Strength:</b> <<print $currentNPC.NPCbasestrength>><br>
<b>🌀 Willpower:</b> <<print $currentNPC.NPCbasewillpower>>
</td>
<td>
<b>🗡️ Attack:</b> <<print $currentNPC.NPCatk>><br>
<b>🛡️ Defense:</b> <<print $currentNPC.NPCdef>><br>
<b>💥 Crit Rate:</b> <<print $currentNPC.NPCcrit>>%<br>
<b>🛑 Crit Resist:</b> <<print $currentNPC.NPCcritres>>%<br>
<b>👟 Agility:</b> <<print $currentNPC.NPCagility>><br>
<b>🥋 Martial Arts:</b> <<print $currentNPC.NPCmartialArts>><br>
<b>🌌 Spiritual Root:</b> <<print $currentNPC.NPCspiritualRoot>>
</td>
</tr>
</table>
</div>
<<else>>
<</if>>
<</widget>>
/* NPC family tree */
<<widget "DrawConnectionMap">>
<<set _focus to $args[0]>>
<<set _rel to _focus.relations || {}>>
<div class="scroll-tree">
<!-- Debug info - remove after testing -->
<!-- Parents: <<= _rel.parents.length >>, Siblings: <<= _rel.siblings.length >>, Masters: <<= _rel.masters.length >>, Apprentices: <<= _rel.apprentices.length >>, Children: <<= _rel.children.length >>, Lovers: <<= _rel.lovers?.length || 0 >> -->
<div class="tree-row">
<!-- MASTERS -->
<<if (_rel.masters || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Master<<if _rel.masters.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.masters>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if _r>>
<<MiniCard _r>>
<<else>>
<!-- Try to find in encounter batch as fallback -->
<<set _r to $encounterBatch[_id]>>
<<if _r>>
<<MiniCard _r>>
<</if>>
<</if>>
<</for>>
</div>
</div>
<</if>>
<!-- PARENTS -->
<<if (_rel.parents || []).length gt 0>>
<<for _id range _rel.parents>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<<if _r>>
<div class="relation-group">
<div class="relation-label"><<print (_r.gender === "male" ? "Father" : "Mother")>></div>
<div class="card-container"><<MiniCard _r>></div>
</div>
<</if>>
<</for>>
<</if>>
</div>
<div class="tree-row">
<!-- SPOUSES/LOVERS -->
<<if (_rel.spouses || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Spouse<<if _rel.spouses.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.spouses>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<<if _r>> <<MiniCard _r>> <</if>>
<</for>>
</div>
</div>
<</if>>
<!-- LOVERS (new category) -->
<<if (_rel.lovers || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Lover<<if _rel.lovers.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.lovers>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<<if _r>> <<MiniCard _r>> <</if>>
<</for>>
</div>
</div>
<</if>>
<!-- FOCUS NPC -->
<div class="npc-mini-card focus">
<div style="font-weight:bold; color:#b22222;">
<<if _focus.isDead>>✟ <</if>><<= _focus.fullname>>
</div>
<div style="font-size:0.75em; color:#666;">(Focus)</div>
</div>
<!-- SIBLINGS -->
<<if (_rel.siblings || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Sibling<<if _rel.siblings.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.siblings>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<<if _r>> <<MiniCard _r>> <</if>>
<</for>>
</div>
</div>
<</if>>
</div>
<div class="tree-row">
<!-- CHILDREN -->
<<if (_rel.children || []).length gt 0>>
<<for _id range _rel.children>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<<if _r>>
<div class="relation-group">
<div class="relation-label"><<print (_r.gender === "male" ? "Son" : "Daughter")>></div>
<div class="card-container"><<MiniCard _r>></div>
</div>
<</if>>
<</for>>
<</if>>
<!-- APPRENTICES -->
<<if (_rel.apprentices || []).length gt 0>>
<div class="relation-group">
<div class="relation-label">Apprentice<<if _rel.apprentices.length gt 1>>s<</if>></div>
<div class="card-container">
<<for _id range _rel.apprentices>>
<<set _r to $known_npc_list.find(n => n.id === _id)>>
<<if not _r>>
<<set _r to $encounterBatch[_id]>>
<</if>>
<<if _r>> <<MiniCard _r>> <</if>>
<</for>>
</div>
</div>
<</if>>
</div>
<!-- If no relations at all -->
<<if (_rel.parents || []).length == 0 and (_rel.siblings || []).length == 0 and (_rel.masters || []).length == 0 and (_rel.apprentices || []).length == 0 and (_rel.children || []).length == 0 and (_rel.spouses || []).length == 0 and (_rel.lovers || []).length == 0>>
<div style="text-align:center; padding:40px; color:#819ca9; font-style:italic;">
No known connections... The threads of fate around this one remain hidden.
</div>
<</if>>
</div>
<</widget>>>
/* NPC mini card for lists and connections */
<<widget "MiniCard">>
<<set _npc to $args[0]>>
<div @class="'npc-mini-card' + (_npc.isDead ? ' dead-npc' : '')">
<span class="treegrid">@@.link-brown;
<<capture _npc>> <!-- Capture the NPC at this moment -->
<<link _npc.fullname "RelationsDetailed">>
<<set $selectedNPCid to _npc.id>>
<img @src="'images/' + _npc.enemyregion + '/' + _npc.enemyimage + '.jpg'">
<</link>>
<</capture>>
@@</span>
</div>
<</widget>>
/* Batch NPC encounter widget */
<<widget "GenerateEncounterBatch">>
<<set _locationType to $args[0]>>
<<set _specificSect to $args[1] || null>>
<<set $encounterBatch to {}>>
<<set _possibleRelatives to []>>
<<set _familiarCount to 0>>
<<set _unknownCount to 0>>
<!-- Determine batch size based on location -->
<<set _batchSize to 0>>
<<switch _locationType>>
<<case "tavern">> <<set _batchSize to random(5, 8)>>
<<case "sect">> <<set _batchSize to random(6, 10)>>
<<case "mortal">> <<set _batchSize to random(4, 7)>>
<<case "wilderness">> <<set _batchSize to random(2, 4)>>
<<default>> <<set _batchSize to random(3, 6)>>
<</switch>>
<!-- FAMILIAR FACES (20-40% of batch) -->
<<set _familiarPercentage to 20>>
<<set _targetFamiliarCount to Math.floor(_batchSize * _familiarPercentage / 100)>>
<<set _targetFamiliarCount to Math.max(1, Math.min(3, _targetFamiliarCount))>>
<!-- Gather possible familiars (relatives + known but unmet NPCs) -->
<<set _possibleFamiliars to []>>
<!-- Add relatives of known NPCs -->
<<set _knownMetList to $known_npc_list.filter(function(n) { return n.isMet and !n.isDead; })>>
<<for _known range _knownMetList>>
<<if _known.relations>>
<<set _relTypes to ["masters", "parents", "spouses", "siblings", "apprentices", "children"]>>
<<for _type range _relTypes>>
<<if _known.relations[_type] and _known.relations[_type].length gt 0>>
<<for _relId range _known.relations[_type]>>
<<set _rel to ($encounterBatch[_relId] || $known_npc_list.find(function(n) { return n.id === _relId; }))>>
<<if _rel and !_rel.isMet and !_rel.isDead>>
<<set _possibleFamiliars.push(_rel)>>
<</if>>
<</for>>
<</if>>
<</for>>
<</if>>
<</for>>
<!-- Also add any unmet NPCs from known_npc_list -->
<<set _unmetList to $known_npc_list.filter(function(n) { return !n.isMet and !n.isDead; })>>
<<for _unmet range _unmetList>>
<<set _found to false>>
<<for _fam range _possibleFamiliars>>
<<if _fam.id is _unmet.id>>
<<set _found to true>>
<</if>>
<</for>>
<<if not _found>>
<<set _possibleFamiliars.push(_unmet)>>
<</if>>
<</for>>
<!-- Select familiars if available -->
<<if _possibleFamiliars.length gt 0>>
<<set _familiarCount to Math.min(_targetFamiliarCount, _possibleFamiliars.length)>>
<<for _i = 0; _i lt _familiarCount; _i++>>
<<set _chosen to _possibleFamiliars.random()>>
<<set _chosen.isFamiliar to true>>
<!-- Check if this is a relative -->
<<set _isRel to false>>
<<for _known range _knownMetList>>
<<if _known.relations>>
<<set _relTypes to ["masters", "parents", "spouses", "siblings", "apprentices", "children"]>>
<<for _type range _relTypes>>
<<if _known.relations[_type] and _known.relations[_type].includes(_chosen.id)>>
<<set _isRel to true>>
<</if>>
<</for>>
<</if>>
<</for>>
<<set _chosen.isRelative to _isRel>>
<<set $encounterBatch[_chosen.id] to _chosen>>
<!-- Remove from pool to avoid duplicates -->
<<set _newFamiliars to []>>
<<for _fam range _possibleFamiliars>>
<<if _fam.id != _chosen.id>>
<<set _newFamiliars.push(_fam)>>
<</if>>
<</for>>
<<set _possibleFamiliars to _newFamiliars>>
<</for>>
<</if>>
<!-- Fill remaining with UNKNOWN NPCs -->
<<set _unknownCount to _batchSize - _familiarCount>>
<<for _i = 0; _i lt _unknownCount; _i++>>
<!-- Determine realm and stage based on location -->
<<set _realmName = "">>
<<set _stageName = "">>
<<switch _locationType>>
<<case "mortal">>
<<set _realmName = "Mortal">>
<<set _stageName = "">>
<<case "sect">>
<<set _realmOptions to ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm"]>>
<<set _stageOptions to ["Early","Middle","Late"]>>
<<set _realmName to _realmOptions.random()>>
<<set _stageName to _stageOptions.random()>>
<<case "wilderness">>
<<set _realmOptions to ["Body Tempering Realm", "Meridian Awakening Realm"]>>
<<set _stageOptions to ["Early","Middle","Late"]>>
<<set _realmName to _realmOptions.random()>>
<<set _stageName to _stageOptions.random()>>
<<default>> <!-- tavern -->
<<set _realmOptions to ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm"]>>
<<set _stageOptions to ["Early","Middle","Late"]>>
<<set _realmName to _realmOptions.random()>>
<<set _stageName to _stageOptions.random()>>
<</switch>>
<!-- Compute power using the correct variables -->
<<set _power = $power[_realmName][_stageName]>>
<!-- Generate NPC based on realm -->
<<set _gender to ["male","female"].random()>>
<<set _name to "">>
<<if _gender eq "male">>
<<set _name to $male_npc_names.random()>>
<<else>>
<<set _name to $female_npc_names.random()>>
<</if>>
<<set _surname to $npc_surnames.random()>>
<<set _fullname to _surname + " " + _name>>
<<set _intTrait = $NPCinternalOptions.random()>>
<<set _extTrait = $NPCexternalOptions.random()>>
<<if _realmName neq "Mortal">>
<<set _stats to $GenerationNPCRealmStats[_realmName][_stageName]>>
<<set _npc to {
id: random(0, 10000) + Date.now()+ _i,
name: _name,
power: _power,
surname: _surname,
fullname: _fullname,
gender: _gender,
realm: _realmName + " " + _stageName,
NPCrank: _locationType eq "sect" ? (_specificSect ? ["Disciple", "Inner Disciple", "Elder"].random() : "Cultivator") : "Cultivator",
sectNPC: _locationType eq "sect" ? (_specificSect || "Unaffiliated") : "Unaffiliated",
NPClocation: _locationType eq "sect" ? (_specificSect || $region) : $region,
enemyregion: "Enemy",
enemyimage: ["enemy1", "enemy2", "enemy3", "enemy4"].random(),
NPCmaxlifespan: random(_stats.lifespan[0], _stats.lifespan[1]),
NPClifespan: random(18, _stats.lifespan[1]),
NPCmaxhealth: random(_stats.health[0], _stats.health[1]),
NPCcurrenthealth: random(_stats.health[0], _stats.health[1]),
NPCmaxenergy: random(_stats.energy[0], _stats.energy[1]),
NPCcurrentenergy: random(_stats.energy[0], _stats.energy[1]),
NPCluck: random(_stats.luck[0], _stats.luck[1]),
NPCinsight: random(_stats.insight[0], _stats.insight[1]),
NPCbasestrength: random(_stats.basestrength[0], _stats.basestrength[1]),
NPCbasewillpower: random(_stats.basewillpower[0], _stats.basewillpower[1]),
NPCatk: random(_stats.atk[0], _stats.atk[1]),
NPCdef: random(_stats.def[0], _stats.def[1]),
NPCcrit: random(_stats.crit[0], _stats.crit[1]),
NPCcritres: random(_stats.critres[0], _stats.critres[1]),
NPCagility: random(_stats.agility[0], _stats.agility[1]),
NPCmartialArts: random(_stats.martialArts[0], _stats.martialArts[1]),
NPCspiritualRoot: random(_stats.spiritualRoot[0], _stats.spiritualRoot[1]),
RightTendencies: random(100,200),
DemonTendencies: random(100,200),
depravity: random(7, 30),
friendship: 0,
charm: 10,
talk: 0,
hadSex: 0,
isMet: false,
isDead: false,
isFamiliar: false,
isRelative: false,
isUnknown: true,
hasGrudge: false,
deathCause: null, /* "old_age", "murder", "revenge_killed", etc.*/
killedByPlayer: false,
killedInRevenge: false, /* true if killed during a revenge encounter*/
deathGrudgeType: null, /* the type of grudge they were avenging*/
deathGrudgeVictim: null, /* the victim they were avenging*/
internalTrait: _intTrait,
externalTrait: _extTrait,
relations: { parents: [], masters: [], spouses: [], siblings: [], children: [], apprentices: [] }
}>>
<<else>>
<!-- Mortal NPC -->
<<set _npc to {
id: random(0, 10000) + Date.now() + _i,
name: _name,
power: _power,
surname: _surname,
fullname: _fullname,
gender: _gender,
realm: "Mortal",
NPCrank: "Commoner",
sectNPC: "Unaffiliated",
NPClocation: $region + " Village",
enemyregion: "Enemy",
enemyimage: ["enemy1", "enemy2", "enemy3", "enemy4"].random(),
NPCmaxlifespan: random(60, 80),
NPClifespan: random(18, 60),
NPCmaxhealth: random(80, 120),
NPCcurrenthealth: random(80, 120),
NPCmaxenergy: random(40, 60),
NPCcurrentenergy: random(40, 60),
NPCluck: random(1, 3),
NPCinsight: random(1, 3),
NPCbasestrength: random(1, 3),
NPCbasewillpower: random(1, 3),
NPCatk: random(5, 10),
NPCdef: random(1, 3),
NPCcrit: 0,
NPCcritres: 0,
NPCagility: random(2, 4),
NPCmartialArts: 0,
NPCspiritualRoot: 0,
RightTendencies: random(100,200),
DemonTendencies: random(100,200),
depravity: random(1, 10),
friendship: 0,
charm: 5,
talk: 0,
hadSex: 0,
deathCause: null, /* "old_age", "murder", "revenge_killed", etc.*/
killedByPlayer: false,
killedInRevenge: false, /* true if killed during a revenge encounter*/
deathGrudgeType: null, /* the type of grudge they were avenging*/
deathGrudgeVictim: null, /* the victim they were avenging*/
isMet: false,
isDead: false,
isFamiliar: false,
isRelative: false,
isUnknown: true,
hasGrudge: false,
relations: { parents: [], masters: [], spouses: [], siblings: [], children: [], apprentices: [] }
}>>
<</if>>
<<set $encounterBatch[_npc.id] to _npc>>
<</for>>
<!-- Store metadata -->
<<set $encounterMetadata to {
locationType: _locationType,
specificSect: _specificSect,
familiarCount: _familiarCount,
unknownCount: _unknownCount,
totalSize: _batchSize
}>>
<</widget>>
<<widget "DisplayEncounter">>
<<set _batch to $encounterBatch>>
<<set _meta to $encounterMetadata || {}>>
<<set _playerLocation to $region>> /* Use your actual player location variable */
<<set _currentpassage to passage()>>
<!-- Count relatives for display -->
<<set _relativeCount to 0>>
<<for _id, _npc range _batch>>
<<if _npc.isRelative>>
<<set _relativeCount to _relativeCount + 1>>
<</if>>
<</for>>
<!-- Find known NPCs at this location -->
<<set _knownAtLocation to []>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<set _knownNPC to $known_npc_list[_i]>>
<<if _knownNPC.NPClocation eq _playerLocation and !_knownNPC.isDead>>
<<set _knownAtLocation.push(_knownNPC)>>
<</if>>
<</for>>
<!-- Dynamic title -->
<<switch _meta.locationType>>
<<case "tavern">>
<h3>✦ Tavern ✦</h3>
<p class="location-desc">The smell of wine and spirit beasts fills the air...</p>
<<case "sect">>
<h3>✦ <<print _meta.specificSect || "The Sect">> Grounds ✦</h3>
<p class="location-desc">Disciples practice forms as elders pass by...</p>
<<case "mortal">>
<h3>✦ Mortal Village Market ✦</h3>
<p class="location-desc">Ordinary folk go about their day, unaware of cultivation...</p>
<<case "wilderness">>
<h3>✦ Wild Mountains ✦</h3>
<p class="location-desc">Dangerous aura permeates the air...</p>
<</switch>>
<!-- Stats bar - compact -->
<div class="encounter-stats-bar">
<span class="stat-pill">Total: <<print _meta.totalSize + _knownAtLocation.length>></span>
<<if _meta.familiarCount gt 0>>
<span class="stat-pill familiar">Familiar: <<print _meta.familiarCount>></span>
<</if>>
<<if _meta.unknownCount gt 0>>
<span class="stat-pill unknown">Unknown: <<print _meta.unknownCount>></span>
<</if>>
<<if _knownAtLocation.length gt 0>>
<span class="stat-pill known">Known: <<print _knownAtLocation.length>></span>
<</if>>
<<if _relativeCount gt 0>>
<span class="stat-pill bloodline">Bloodline: <<print _relativeCount>></span>
<</if>>
</div>
<div class="encounter-grid">
<!-- First display known NPCs at this location -->
<<for _known range _knownAtLocation>>
<<capture _known>>
<div class="encounter-card known-card">
<!-- Top row: Name/rank and indicator -->
<div class="card-header">
<span class="card-title">
<<print _known.fullname>>
</span>
<<if _known.relations and ( _known.relations.parents.length gt 0 or _known.relations.siblings.length gt 0 or _known.relations.spouses.length gt 0 )>>
<span class="card-badge bloodline" title="Has family connections">⚡</span>
<</if>>
</div>
<!-- Middle: Realm -->
<div class="card-realm">
<<if _known.realm>>
<<print _known.realm>>
<<else>>
Commoner
<</if>>
</div>
<!-- Bottom: Sect (if any) -->
<<if _known.sectNPC and _known.sectNPC neq "Unaffiliated">>
<div class="card-sect" title="<<print _known.sectNPC>>">
<<print _known.sectNPC.split(" ").slice(0,2).join(" ")>>
</div>
<</if>>
<!-- Approach link -->
<div class="card-action">
<<link "Approach">>
<<set $currentEncounterNPC to _known>>
<<set $encounterOrigin to _meta.locationType>>
<<goto "EncounterInteraction">>
<</link>>
</div>
</div>
<</capture>>
<</for>>
<!-- Then display unknown/batch NPCs -->
<<for _id, _npc range _batch>>
<<capture _npc>>
<div class="encounter-card">
<!-- Top row: Name/rank and indicator -->
<div class="card-header">
<span class="card-title">
<<if _npc.isUnknown>>
???
<<else>>
<<if _npc.realm eq "Mortal">>
Mortal
<<else>>
<<print _npc.NPCrank || "Cultivator">>
<</if>>
<</if>>
</span>
<<if _npc.isFamiliar and !_npc.isUnknown>>
<span class="card-badge <<if _npc.isRelative>>bloodline<<else>>familiar<</if>>">
<<if _npc.isRelative>>⚡<<else>>✦<</if>>
</span>
<</if>>
</div>
<!-- Middle: Realm (compact) -->
<div class="card-realm">
<<if !_npc.isUnknown and _npc.realm and _npc.realm neq "Mortal">>
<<print _npc.realm>>
<<elseif !_npc.isUnknown and _npc.realm eq "Mortal">>
Commoner
<<else>>
<span class="unknown-text">???</span>
<</if>>
</div>
<!-- Bottom: Sect (if any) -->
<<if !_npc.isUnknown and _npc.sectNPC and _npc.sectNPC neq "Unaffiliated">>
<div class="card-sect" title="<<print _npc.sectNPC>>">
<<print _npc.sectNPC.split(" ").slice(0,2).join(" ")>>
</div>
<</if>>
<!-- Approach link -->
<div class="card-action">
<<link "Approach">>
<<set $currentEncounterNPC to _npc>>
<<set $encounterOriginPassage to passage()>>
<<goto "EncounterInteraction">>
<</link>>
</div>
</div>
<</capture>>
<</for>>
</div>
<!-- Refresh option -->
<div class="encounter-actions">
<<if $energy gte 10>>
<<link "⟳ Wait" _currentpassage>>
<<GenerateEncounterBatch _meta.locationType _meta.specificSect>>
<<DisplayEncounter>>
<</link>>
<</if>>
</div>
<</widget>><<widget "RelationshipType">>
<<if _npc neq null>>
<<if _npc.relationshipType is "enemy">>
Enemy
<<elseif _npc.relationshipType is "lover" and _npc.hadSex neq null and _npc.hadSex eq 1>>
Lover
<<elseif _npc.mentorshipType neq null and _npc.mentorshipType eq 1>>
Master
<<elseif _npc.mentorshipType neq null and _npc.mentorshipType eq 2>>
Apprentice
<<elseif _npc.friendship neq null and _npc.talk neq null and _npc.friendship gte 30 and _npc.friendship lt 70>>
Friend
<<elseif _npc.friendship neq null and _npc.talk neq null and _npc.friendship lt 20 and _npc.talk lt 3>>
Stranger
<<else>>
Acquaintance
<</if>>
<<else>>
Stranger
<</if>>
<</widget>>
<<widget "NPCMeter">>
<<set _percent = Math.clamp(($args[0] / $args[1]) * 100, 0, 100)>>
<div class="meter-container">
<div class="meter-label">_args[2]: $args[0] / $args[1]</div>
<div class="meter-bg">
<div class="meter-fill" @style="'width: ' + _percent + '%; background-color: ' + $args[3] + ';'"></div>
</div>
</div>
<</widget>>
<<widget "NpcPosition">>
<<if $turns % 12 == 0>>
<<for _ab range $known_npc_list>>
<<set _ab.NPClocation = ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain", "Ghost King Netherworld Sect", "Clear Sky Azure Dragon Pavilion"].random()>>
<</for>>
<</if>>
<</widget>>
<<widget "BattleAddNPC">>\
<<run $known_npc_list.push($currentEnemy)>>\
<</widget>>\
<<widget "AddNPC">>\
<<run $known_npc_list.push(_npc)>>\
<</widget>>\
<<widget "RemoveNPC">>
<<capture _npc>>
<<for _i to 0; _i < $known_npc_list.length; _i++>>
<<if $known_npc_list[_i].id is _npc.id>>
<<run $known_npc_list.deleteAt(_i)>>
<<break>>
<</if>>
<</for>>
/* Optional: Reset page if list becomes empty or current page is invalid */
<<if $known_npc_list.length is 0 or $relationPage > Math.ceil($known_npc_list.length / 3)>>
<<set $relationPage to 1>>
<</if>>
<</capture>>
<</widget>>
<<widget "AddNPCWithFamily">>
<<silently>>
<<set _mainNPC to $args[0]>>
/* 1. Automatically mark the main NPC as met and known */
<<set _mainNPC.isMet to true>>
<<set _mainNPC.isUnknown to false>>
/* 2. Safety Check: Only push if they aren't already in the list */
<<if !$known_npc_list.some(function(n) { return n.id === _mainNPC.id; })>>
<<run $known_npc_list.push(_mainNPC)>>
<<else>>
/* If they somehow already exist, update their data instead of duplicating */
<<set _idx to $known_npc_list.findIndex(function(n) { return n.id === _mainNPC.id; })>>
<<run Object.assign($known_npc_list[_idx], _mainNPC)>>
<</if>>
/* Store current batch */
<<set _tempBatch to $encounterBatch>>
/* Generate family - this creates a fresh $encounterBatch */
<<GenerateLineageBatch _mainNPC>>
/* 3. Add all family members (keeping them unknown until the player actually meets them) */
<<for _id, _family range $encounterBatch>>
<<if _family.id != _mainNPC.id>>
<<set _family.isMet to false>>
<<set _family.isUnknown to true>>
/* Safety Check for family members too */
<<if !$known_npc_list.some(function(n) { return n.id === _family.id; })>>
<<run $known_npc_list.push(_family)>>
<</if>>
<</if>>
<</for>>
/* Restore original encounter batch */
<<set $encounterBatch to _tempBatch>>
<</silently>>
<</widget>>
<!-- Display NPC's -->
<<widget "DisplayNPCS">>
/* Accept arguments - $args[0] will be the first argument after widget name */
<<set _locationType to $args[0] || "wilderness">> /* Default to "sect" if not provided */
<<set _specificSect to $args[1] || null>> /* Optional second argument */
<<if $peopleVisible is undefined>>
<<set $peopleVisible = false>>
<</if>>
<div id="people-ui">
<<if $peopleVisible>>
<<link "Avert your gaze">>
<<set $peopleVisible = false>>
<<run Engine.play(passage())>>
<</link>>
<div style="margin-top:10px;">
<<DisplayEncounter>>
</div>
<<else>>
<<link "Look around people">>
<<set $peopleVisible = true>>
/* Pass the arguments to GenerateEncounterBatch */
<<GenerateEncounterBatch _locationType _specificSect>>
<<run Engine.play(passage())>>
<</link>>
<</if>>
</div>
<</widget>>
<<widget "UpdateNPCStatsForRealm">>
<<silently>>
<<set _npc = $args[0]>>
<<set _debug = []>> /* For debugging */
/* Safety checks */
<<if not _npc>>
<<set _debug.push("No NPC provided")>>
<<elseif not _npc.realm>>
<<set _debug.push("NPC has no realm property")>>
<</if>>
<<if _debug.length == 0>>
<<set _realmName = _npc.realm.split(" ").slice(0,-1).join(" ")>>
<<set _stageName = _npc.realm.split(" ").pop()>>
<<set _debug.push("Realm: " + _realmName + ", Stage: " + _stageName)>>
/* Check if stats object exists */
<<if not window.GenerationNPCRealmStats and not $GenerationNPCRealmStats>>
<<set _debug.push("ERROR: $GenerationNPCRealmStats is not defined")>>
<<else>>
<<set _statsObj = $GenerationNPCRealmStats || window.GenerationNPCRealmStats>>
<<if not _statsObj[_realmName]>>
<<set _debug.push("ERROR: No stats for realm: " + _realmName)>>
<<elseif not _statsObj[_realmName][_stageName]>>
<<set _debug.push("ERROR: No stats for stage: " + _stageName + " in realm " + _realmName)>>
<<else>>
<<set _stats = _statsObj[_realmName][_stageName]>>
<<set _debug.push("Stats found, updating...")>>
/* Update stats */
<<set _npc.NPCmaxhealth = random(_stats.health[0], _stats.health[1])>>
<<set _npc.NPCcurrenthealth = _npc.NPCmaxhealth>>
<<set _npc.NPCmaxenergy = random(_stats.energy[0], _stats.energy[1])>>
<<set _npc.NPCcurrentenergy = _npc.NPCmaxenergy>>
<<set _npc.NPCluck = random(_stats.luck[0], _stats.luck[1])>>
<<set _npc.NPCinsight = random(_stats.insight[0], _stats.insight[1])>>
<<set _npc.NPCbasestrength = random(_stats.basestrength[0], _stats.basestrength[1])>>
<<set _npc.NPCbasewillpower = random(_stats.basewillpower[0], _stats.basewillpower[1])>>
<<set _npc.NPCatk = random(_stats.atk[0], _stats.atk[1])>>
<<set _npc.NPCdef = random(_stats.def[0], _stats.def[1])>>
<<set _npc.NPCcrit = random(_stats.crit[0], _stats.crit[1])>>
<<set _npc.NPCcritres = random(_stats.critres[0], _stats.critres[1])>>
<<set _npc.NPCagility = random(_stats.agility[0], _stats.agility[1])>>
<<set _npc.NPCmartialArts = random(_stats.martialArts[0], _stats.martialArts[1])>>
<<set _npc.NPCspiritualRoot = random(_stats.spiritualRoot[0], _stats.spiritualRoot[1])>>
<<set _npc.NPCmaxlifespan = random(_stats.lifespan[0], _stats.lifespan[1])>>
<<set _debug.push("Update complete")>>
<</if>>
<</if>>
<</if>>
/* Store debug info for display */
<<set $lastStatsDebug = _debug>>
<</silently>>
/* Optionally display debug output */
<<if $debugMode>>
<div style="border:1px solid blue; padding:5px; margin:5px; font-size:small;">
<b>Stats Update Debug:</b><br>
<<for _msg range $lastStatsDebug>>
<<print _msg>><br>
<</for>>
</div>
<</if>>
<</widget>>
<<widget "NPCRumours">>
<<if $known_npc_list.length gt 0>>
<<if random(1,100) lte 20>>
<<set _npc to $known_npc_list.random()>>
<<set _rumourType to random(1,100)>>
<<set _text to "">>
<<if _npc.isDead>>
<<set _rumourType to 95>> /* Redirect to death memory */
<</if>>
<<switch _rumourType>>
<<case 1 to 6>> /* Breakthrough! (6%) */
<<set _stages to ["early", "middle", "late"]>>
<<set _currentStage to _npc.realm.split(" ").pop()>>
<<set _idx to _stages.indexOf(_currentStage)>>
<<if _idx lt 2>>
<<set _newStage to _stages[_idx + 1]>>
<<set _npc.realm to _npc.realm.split(" ").slice(0,-1).join(" ") + " " + _newStage>>
<<UpdateNPCStatsForRealm _npc>>
<<set _text to `Whispers spread like wildfire: ${_npc.fullname} has achieved a breakthrough to ${_newStage}-stage ${_npc.realm.split(" ").slice(0,-1).join(" ")}!`>>
<<else>>
<<set _realms to ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm"]>>
<<set _curRealmName to _npc.realm.split(" ").slice(0,-1).join(" ")>>
<<set _curRealmIdx to _realms.indexOf(_curRealmName)>>
<<if _curRealmIdx lt _realms.length - 1>>
<<set _npc.realm to _realms[_curRealmIdx + 1] + " early">>
<<UpdateNPCStatsForRealm _npc>>
<<set _text to `Heavenly phenomena were seen! ${_npc.fullname} has stepped into the ${_realms[_curRealmIdx + 1]}!`>>
<<else>>
<<set _text to `Rumours say ${_npc.fullname} is attempting core formation in seclusion... but nothing confirmed yet.`>>
<</if>>
<</if>>
<<case 7 to 9>> /* Tragic Death (3%) */
<<if !_npc.isDead>>
<<set _npc.isDead to true>>
<<set _npc.deathCause = "murder">>
<<set _npc.killedByPlayer = false>>
<<set _npc.killedInRevenge = false>>
/* If NPC had an active grudge, mention it */
<<if _npc.hasGrudge>>
<<set _text to `A bloodied jade slip arrived from ${_npc.NPClocation}: ${_npc.fullname} perished in a deadly ambush. Some say they were hunting someone... but their vengeance died with them.`>>
<<else>>
<<set _text to `A bloodied jade slip arrived from ${_npc.NPClocation}: ${_npc.fullname} perished in a deadly ambush. Their name fades from the Jianghu...`>>
<</if>>
<</if>>
<<case 10 to 19>> /* Saved villagers / Righteous act (10%) */
<<set _npc.RightTendencies to _npc.RightTendencies + random(15,35)>>
<<set _npc.depravity to Math.max(0, _npc.depravity - random(5,12))>>
<<set _text to `Travellers speak warmly of ${_npc.fullname}, who reportedly saved a mortal village from demonic beasts. Righteous aura grows stronger around them.`>>
<<case 20 to 29>> /* Massacred innocents / Demonic act (10%) */
<<set _npc.DemonTendencies to _npc.DemonTendencies + random(20,40)>>
<<set _npc.depravity to _npc.depravity + random(8,18)>>
<<set _text to `Dark whispers from ${_npc.NPClocation}: ${_npc.fullname} slaughtered an entire caravan of innocents. Blood qi swirls thicker around them now.`>>
<<case 30 to 39>> /* Left/Kicked from sect (10%) */
<<if _npc.sectNPC neq "Unaffiliated">>
<<set _oldSect to _npc.sectNPC>>
<<set _npc.sectNPC to "Unaffiliated">>
<<set _npc.NPCrank to "">>
<<set _text to `Shock in the cultivation world: ${_npc.fullname} has been expelled from the ${_oldSect}! Some say betrayal, others speak of forbidden techniques...`>>
<<else>>
<<set _text to `Merchants gossip that ${_npc.fullname} has taken on a mysterious new disciple in the wilderness.`>>
<</if>>
<<case 40 to 49>> /* Joined a sect (10%) */
<<if _npc.sectNPC is "Unaffiliated">>
<<set _newSect to ["Clear Sky Azure Dragon Pavilion", "Ghost King Netherworld Sect"].random()>>
<<set _npc.sectNPC to _newSect>>
<<set _npc.NPCrank to ["Disciple", "Member"].random()>>
<<set _text to `${_npc.fullname} has officially joined the ${_newSect}! Their future now lies with a major power.`>>
<<else>>
<<set _text to `Word is ${_npc.fullname} discovered an ancient ruin and emerged with valuable treasures.`>>
<</if>>
<<case 50 to 61>> /* Seclusion training (12%) */
<<set _npc.NPCinsight to _npc.NPCinsight + random(2,6)>>
<<set _npc.NPCbasewillpower to _npc.NPCbasewillpower + random(1,4)>>
<<set _text to `It is said ${_npc.fullname} has entered closed-door cultivation for months. Their foundation grows deeper...`>>
<<case 62 to 71>> /* Dual cultivation scandal / Charm increase (10%) */
<<set _npc.charm to _npc.charm + random(5,12)>>
<<set _npc.depravity to _npc.depravity + random(3,10)>>
<<set _text to `Taverns buzz with scandalous tales of ${_npc.fullname}'s passionate dual cultivation with a mysterious partner. Their charm has become almost bewitching.`>>
<<case 72 to 81>> /* Found treasure / Luck boost (10%) */
<<set _npc.NPCluck to _npc.NPCluck + random(3,8)>>
<<set _text to `Fortune smiles on ${_npc.fullname} — they discovered a hidden spirit herb garden deep in the mountains!`>>
<<case 82 to 91>> /* Injured in battle (10%) */
<<set _npc.NPCcurrenthealth to Math.max(1, _npc.NPCcurrenthealth - random(10,30))>>
<<set _text to `Grave news: ${_npc.fullname} was severely wounded in a fierce battle against a rival. They are recovering slowly...`>>
<<case 92 to 94>> /* Moved to new location (3%) */
<<set _oldLoc to _npc.NPClocation>>
<<set _newLoc to ["Jade Creek Town", "Northern Phoenix City", "Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _npc.NPClocation to _newLoc>>
<<set _text to `${_npc.fullname} has been spotted travelling towards ${_newLoc}. Perhaps they seek new opportunities there.`>>
<<case 95 to 97>> /* Memory of the dead (3%) */
<<if _npc.isDead>>
<<if _npc.killedByPlayer>>
<<if _npc.killedInRevenge>>
<<set _text to `Elderly cultivators sigh, remembering ${_npc.fullname} – a soul consumed by vengeance. "They died seeking justice... or perhaps madness."`>>
<<else>>
<<set _text to `Whispers speak of ${_npc.fullname}'s end at the hands of a mysterious cultivator. "Their killer walks free," they mutter.`>>
<</if>>
<<else>>
<<set _text to `Elderly cultivators sigh, remembering ${_npc.fullname}'s legendary sword technique. "If only they had lived longer..."`>>
<</if>>
<<else>>
<<set _text to `A wandering poet sings of ${_npc.fullname}'s deeds, comparing them to the immortals of old.`>>
<</if>>
<<case 98 to 99>> /* Rumours of revenge (2%) */
<<if $activeGrudges and $activeGrudges.length gt 0>>
<<set _randomGrudge to $activeGrudges.random()>>
<<set _text to `Whispers carry dark tidings: ${_randomGrudge.avengerName} hunts for the one who wronged ${_randomGrudge.victimName}. Vengeance is coming.`>>
<</if>>
<<default>> /* Pure flavor (10%) */
<<set _genderTerm to (_npc.gender is "female" ? "beauty" : "handsomeness")>>
<<set _flavors to [
`${_npc.fullname} was seen drinking alone under the moon in ${_npc.NPClocation}, lost in thought.`,
`Poets compose verses about ${_npc.fullname}'s peerless sword intent that split a waterfall in twain.`,
`Children in ${_npc.NPClocation} tell stories of how ${_npc.fullname} once flew across the sky on a sword of light.`,
`Old cultivators argue whether ${_npc.fullname}'s ${_genderTerm} comes from their cultivation or natural gift.`,
`A mysterious jade slip mentions ${_npc.fullname} will play a crucial role in the upcoming sect tournament.`,
`Merchants report seeing ${_npc.fullname} purchasing rare ingredients for a mysterious pill recipe.`
]>>
<<set _text to _flavors.random()>>
<</switch>>
<<if _text neq "">>
<div class="rumour-event">
<strong>◎ Rumour from the Jianghu ◎</strong><br>
<<print _text>>
</div>
<</if>>
<</if>>
<</if>>
<</widget>><!-- Arrogant Young Master Widgets -->
<<widget "set_aym_doggy_desc">>
<<set _random_desc_1 = $vagDoggyArrogantYMdesc.pluck()>>
<<set _random_desc_2 = $vagDoggyArrogantYMdesc.pluck()>>
<<set _random_desc_3 = $vagDoggyArrogantYMdesc.pluck()>>
<<set $vagDoggyArrogantYMdesc = [
"He fucks you hard - hands gripping your hips, teeth at your neck, hips slamming into you with practiced cruelty. Every thrust is punctuated by some mocking praise.",
"His cock drives deep from behind, your ass slapping against his hips with every punishing thrust. He uses you like a toy, panting with pleasure as he dominates you.",
"You feel completely exposed as he takes you from behind, one hand on your neck and the other spanking your ass between thrusts. There's no gentleness - just raw, possessive force.",
"He grabs your hair and pulls you back as he thrusts deeper. Your cries only make him grin harder - you’re being claimed, over and over again.",
"Bent over with your face pressed to the bedding, you can only moan as he ruts into you like a beast in heat. He fucks like he owns you, and in this moment, maybe he does."
]>>
<</widget>>
<<widget "set_aym_doggy_talk">>
<<set _random_talk_1 = $vagArrogantYMtalks.pluck()>>
<<set _random_talk_2 = $vagArrogantYMtalks.pluck()>>
<<set _random_talk_3 = $vagArrogantYMtalks.pluck()>>
<<set $vagArrogantYMtalks = [
"You moan like a whore.",
"Maybe I’ll keep you here. You’d look perfect leashed beneath my desk.",
"I knew you’d be good on all fours.",
"You're dripping like a bitch in heat. Don't pretend you're not loving this.",
"Say thank you, slut - thank me for fucking you.",
"No one's going to fuck you like this again. I ruin everything I use.",
"You're not even trying to resist anymore. Good. Know your place.",
"Do you like being used by someone above your station?"
]>>
<</widget>>
<<widget "set_aym_cowgirl_desc">>
<<set _random_desc_1 = $vagCowgirlArrogantYMdesc.pluck()>>
<<set _random_desc_2 = $vagCowgirlArrogantYMdesc.pluck()>>
<<set _random_desc_3 = $vagCowgirlArrogantYMdesc.pluck()>>
<<set $vagCowgirlArrogantYMdesc = [
"He pulls you into his lap, your back to his chest, and forces you down onto his cock, letting you ride him like a toy built for his pleasure.",
"His hand cracks down on your ass, sharp and loud, leaving a red mark that stings with each bounce.",
"You feel his cock throb deep inside as he guides your hips, fucking you from beneath while you moan helplessly."
]>>
<</widget>>
<<widget "set_aym_cowgirl_talk">>
<<set _random_talk_1 = $vagArrogantYMtalks.pluck()>>
<<set _random_talk_2 = $vagArrogantYMtalks.pluck()>>
<<set _random_talk_3 = $vagArrogantYMtalks.pluck()>>
<<set $vagArrogantYMtalks = [
"Louder. I want everyone outside to hear what a good whore you are.",
"You ride like you've done this before - don't lie to me.",
"That ass will carry my handprint for days. Perfect.",
"I could sit here all night and let you fuck yourself stupid on my cock."
]>>
<</widget>>
<<widget "set_aym_proneboneANAL_desc">>
<<set _random_desc_1 = $analProneArrogantYMdesc.pluck()>>
<<set _random_desc_2 = $analProneArrogantYMdesc.pluck()>>
<<set _random_desc_3 = $analProneArrogantYMdesc.pluck()>>
<<set $analProneArrogantYMdesc = [
"He shoves your face down into the cushion, lifting your hips and exposing your hole before pushing inside slowly, stretching you open inch by inch.",
"Each thrust is hard and deep, his hips smacking against your ass while your moans are muffled in the fabric beneath you.",
"He leans over your back, breathing hotly into your ear as he pounds into your ass like he owns it."
]>>
<</widget>>
<<widget "set_aym_proneboneANAL_talk">>
<<set _random_talk_1 = $analArrogantYMtalks.pluck()>>
<<set _random_talk_2 = $analArrogantYMtalks.pluck()>>
<<set _random_talk_3 = $analArrogantYMtalks.pluck()>>
<<set $analArrogantYMtalks = [
"Face down, ass up - just how I like my pets.",
"You’ll feel this every time you sit, and you’ll remember who did it to you.",
"Even your tight little hole can't resist me.",
"You're nothing but a hole for my pleasure now. Accept it."
]>>
<</widget>>
<<widget "AymFinisher">>
<<set _roll to random(1,3)>>
<<if _roll eq 1>>
<img src="images/Sex/vagCreampie.webp" class="nsfw-glow">>
<<set _finisher_desc_1 = $vagArrogantYMcumCreampie.pluck()>>
<<set $vagArrogantYMcumCreampie = [
"With a final, brutal thrust, he buries himself deep - your walls clamp around him just as hot spurts of cum flood your pussy. He grunts, grinding in to make sure it all stays inside.",
"He slams in and holds you tight, cock twitching as he fills you. Warm, thick seed spills deep, and he sighs in satisfaction like he just claimed a prize.",
"You feel his cock throb deep inside, and then the hot rush of release. His cum leaks from you almost instantly, but he stays buried, as if daring it to escape.",
"His rhythm falters, then stops - and he groans low as he spills into you. You can feel every pulse, every drop marking you from the inside.",
"He fucks you straight through his climax, pumping cum into you with each lingering thrust. It’s messy, filthy, and he clearly loves it that way."
]>>
<<set _finisher_talk_1 = $vagArrogantYMcumTalkCreampie.pluck()>>
<<set $vagArrogantYMcumTalkCreampie = [
"That's where you belong - dripping full of me.",
"Hope you weren’t planning on using that hole for anyone else.",
"Mmm. You feel better wrapped around my cock than anyone else has.",
"I’ll leave it in for a while - wouldn’t want it leaking out too soon.",
"Consider yourself claimed. You’ll be smelling like me for days."
]>>
<<elseif _roll eq 2>>
<img src="images/Sex/swallow.webp" class="nsfw-glow">>
<<set _finisher_desc_1 = $ArrogantYMcumMouth.pluck()>>
<<set $ArrogantYMcumMouth = [
"He shoves your head down, groaning as he cums. Hot, bitter seed hits the back of your throat in thick spurts, and he doesn’t let you up until you’ve swallowed every drop.",
"His cock pulses against your tongue as he fills your mouth. You can’t help but gag slightly, but he just grins and tells you to keep going - to take it all.",
"He moans low and steady, holding your head tight as he cums directly into your mouth. You’re left with no choice but to swallow or choke.",
"Warm cum floods your mouth as he finishes, and you can taste every humiliating drop. He pulls out slow and wipes the tip against your lips.",
"He cums hard, and you feel it fill your mouth almost instantly. It drips down your chin as he laughs and wipes the excess across your cheek."
]>>
<<set _finisher_talk_1 = $vagArrogantYMcumTalkMouth.pluck()>>
<<set $vagArrogantYMcumTalkMouth = [
"Swallow it all. Don’t waste a drop.",
"Good whore. Maybe I’ll let you taste it again sometime.",
"You make a decent cumdump, I’ll give you that.",
"Open wider next time. I want to see it pool on your tongue.",
"Keep your mouth open. I’m not done using it."
]>>
<<elseif _roll eq 3>>
<<set _random0 = random(0,1)>>
<<if _random0 eq 0>>
<img src="images/Sex/facial.webp" class="nsfw-glow"><<elseif _random0 eq 1>>
<img src="images/Sex/facial1.webp" class="nsfw-glow"><</if>>
<<set _finisher_desc_1 = $ArrogantYMcumFace.pluck()>>
<<set $ArrogantYMcumFace = [
"He jerks himself fast, then tilts your chin up - hot ropes of cum splash across your cheeks, lips, and nose. You feel it drip as he smirks.",
"With a low grunt, he strokes out thick spurts that land across your face - some hitting your forehead, others your lips. You’re painted in disgrace.",
"His cock twitches in his grip, then he releases - warm cum hitting your face in wet splashes, some getting in your hair. He looks proud of the mess.",
"You close your eyes just in time. Cum streaks across your face, running down your jaw and onto your collarbone. He chuckles and calls it an improvement.",
"He holds your face steady, aiming every pulse of cum directly onto your features. You're left dripping, sticky, and humiliated - just how he likes it."
]>>
<<set _finisher_talk_1 = $vagArrogantYMcumTalkFace.pluck()>>
<<set $vagArrogantYMcumTalkFace = [
"Now that’s a good look for you. So fucking pretty like this.",
"Smile for me. Let everyone see how I decorated you.",
"Stay still. I want to admire my work.",
"That’s what your face is good for - catching my cum.",
"Wipe it off? No. Walk around like that. Let them know."
]>>
<</if>>
<</widget>>
<<widget "AymTavernImg">>
<<if _position eq "doggy">>
<<set _random0 to random(0,1)>>
<<if _random0 eq 0>>
<img src="images/Sex/doggy.webp" class="nsfw-glow"><<elseif _random0 eq 1>>
<img src="images/Sex/doggy1.webp" class="nsfw-glow"><</if>>
<<elseif _position eq "cowgirl">>
<<set _random0 to random(0,2)>>
<<if _random0 eq 0>>
<img src="images/Sex/revcow.webp" class="nsfw-glow"><<elseif _random0 eq 1>>
<img src="images/Sex/revcow2.webp" class="nsfw-glow"><<elseif _random0 eq 2>>
<img src="images/Sex/revcow3.webp" class="nsfw-glow"><</if>>
<</if>>
<<if _penetration eq "anal">>
<<set _random0 to random(0,4)>>
<<if _random0 eq 0>>
<img src="images/Sex/pb.webp" class="nsfw-glow"><<elseif _random0 eq 1>>
<img src="images/Sex/pb1.webp" class="nsfw-glow"><<elseif _random0 eq 2>>
<img src="images/Sex/pb2.webp" class="nsfw-glow"><<elseif _random0 eq 3>>
<img src="images/Sex/pb3.webp" class="nsfw-glow"><<elseif _random0 eq 4>>
<img src="images/Sex/pb4.webp" class="nsfw-glow"><</if>>
<</if>>
<</widget>>
<!-- End of Arrogant Young Master Widgets --><<widget "Penetration_roll">>
<<set _roll to random(0,100)>>
<<if _roll lte 15>>
<<set _penetration to "anal">>
He's going for your ass!
<<else>>
<<set _penetration to "vaginal">>
He's going for your pussy.
<</if>>
<</widget>>
<!-- Universal Repeatable NSFW Scene Widget -->
<!--======================================== -->
<!--======================================== -->
<!--======================================== -->
<!--======================================== -->
<<widget "FinishScene">>
<<set _partner = $args[0]>>
<<set _sceneType = $args[1]>>
<<set _climaxType = $args[2] ?? "none">>
<<set _return = $args[3] ?? $passage>>
/* Scene‑type specific stat changes & logging */
<<if _sceneType eq "forced_npc">>
<<set $corruption = Math.min(100, $corruption + 10)>>
<<set _partner.friendship = Math.max(0, _partner.friendship - 15)>>
<<set _partner.depravity += 2>>
<<LogEvent "sex" "Spirit Shattered" `"Your dignity was trampled by " + _partner.fullname + " in a brutal encounter that stained your path to immortality."` 4 _partner.id _partner.fullname>>
<<elseif _sceneType eq "aggressive_player">>
<<set $corruption = Math.min(100, $corruption + 8)>>
<<set _partner.friendship = Math.max(0, _partner.friendship - 10)>>
<<set _partner.depravity += 3>>
<<LogEvent "sex" "Dominant Will" `"You imposed your will upon " + _partner.fullname + ", asserting your dominance in the realm of flesh."` 4 _partner.id _partner.fullname>>
<<elseif _sceneType eq "rape_player">>
<<set $corruption = Math.min(100, $corruption + 15)>>
<<set _partner.friendship = Math.max(0, _partner.friendship - 25)>>
<<set _partner.depravity += 5>>
<<LogEvent "sex" "Demonic Violation" `"A dark act committed against " + _partner.fullname + ", leaving their spirit broken and your own heart colder."` 5 _partner.id _partner.fullname>>
<<elseif _sceneType eq "consensual_flirt">>
<<set $corruption = Math.min(100, $corruption + 3)>>
<<set _partner.friendship = Math.min(100, _partner.friendship + 8)>>
<<set _partner.depravity += 1>>
<<LogEvent "sex" "Fated Entwinement" `"A night of shared breath and flowing Qi with " + _partner.fullname + " has strengthened your worldly bonds."` 2 _partner.id _partner.fullname>>
<<elseif _sceneType eq "consensual_seduce">>
<<set $corruption = Math.min(100, $corruption + 5)>>
<<set _partner.friendship = Math.min(100, _partner.friendship + 12)>>
<<set _partner.depravity += 2>>
<<LogEvent "sex" "Captivating the Spirit" `"Through charms and intent, you drew " + _partner.fullname + " into a night of profound dual pleasure."` 3 _partner.id _partner.fullname>>
<<elseif _sceneType eq "revenge_victory">>
<<set $corruption = Math.min(100, $corruption + 10)>>
<<set _partner.friendship = Math.max(0, _partner.friendship - 20)>>
<<set _partner.depravity += 8>>
<<set $sexFame += 5>>
<<LogEvent "sex" "Vanquished Pride" `"Having defeated " + _partner.fullname + " in combat, you claimed their dignity as your trophy."` 5 _partner.id _partner.fullname>>
<<elseif _sceneType eq "revenge_loss">>
<<set $corruption = Math.min(100, $corruption + 8)>>
<<set $sexFame += 5>>
<<LogEvent "sex" "Humbled by the Victor" `"Defeat led to deep humiliation; you were forced to submit to " + _partner.fullname + "'s vengeful desires."` 5 _partner.id _partner.fullname>>
<<elseif _sceneType eq "brothel_hire">>
/* Hiring a courtesan */
<<set $corruption = Math.min(100, $corruption + random(2,4))>>
<<set $sexFame += 2>>
<<set $health = Math.min($maxhealth, $health + random(0,15))>> /* Optional pleasure boost */
<<LogEvent "sex" "Brothel Visit" `"You spent a night with " + _partner.fullname + " at the Crimson Blossom."` 2>>
<<elseif _sceneType eq "brothel_work">>
<<set $corruption = Math.min(100, $corruption + random(3,6))>>
<<set $sexFame += 4>>
<<set $gold += random(80, 200)>>
<<LogEvent "sex" "Brothel Work" "You worked a night at the Crimson Blossom, earning spirit stones." 3>>
<<elseif _sceneType eq "mission_sex">>
/* Generic mission sex handler – uses $currentMissionEffects */
<<MissionFinishAuto>>
<<if $currentMissionEffects>>
<<set $corruption = Math.min(100, $corruption + $currentMissionEffects.corruption)>>
<<set $sexFame += $currentMissionEffects.sexFame>>
<<if $currentMissionEffects.righteousreputation != 0>>
<<set $righteousreputation = Math.max(0, $righteousreputation + $currentMissionEffects.righteousreputation)>>
<</if>>
<<unset $currentMissionEffects>>
<<unset $missionDominance>>
/* Complete the mission (assumes MissionFinish widget exists) */
<</if>>
<</if>>
/* Climax‑type bonuses (only apply if partner is a real NPC with stats) */
<<if _partner and _partner.friendship is not undefined>>
<<if _climaxType eq "mutual">>
<<set $corruption = Math.min(100, $corruption + 1)>>
<<set _partner.friendship = Math.min(100, _partner.friendship + 2)>>
<<elseif _climaxType eq "player_first">>
<<set $corruption = Math.min(100, $corruption + 2)>>
<<set _partner.friendship = Math.min(100, _partner.friendship + 1)>>
<<elseif _climaxType eq "npc_first">>
<<set $corruption = Math.min(100, $corruption + 1)>>
<<set _partner.depravity += 2>>
<<elseif _climaxType eq "forced_by_player">>
<<set $corruption = Math.min(100, $corruption + 5)>>
<<set _partner.friendship = Math.max(0, _partner.friendship - 5)>>
<</if>>
<</if>>
/* Update the NPC in the known list */
<<set _index = $known_npc_list.findIndex(function(n) { return n.id === _partner.id; })>>
<<if _index >= 0>>
<<set $known_npc_list[_index] = _partner>>
<</if>>
/* Always add general sex fame (small) */
<<set $sexFame += random(1,2)>>
<<goto _return>>
<</widget>>
<<widget "CasualSex">>
<<set _partnerArg to $args[0] ?? "your partner">>
<<set _reason to $args[1] ?? "for pleasure">>
<<set _dominance to $args[2] ?? "neutral">>
<<set _mode to $args[3] ?? "full">>
<<set _return to $args[4] ?? $passage>>
<<set _scene = $args[5] ?? null>>
<<set _originalType = $args[6] ?? "casual">>
/* Detect if first argument is an NPC object */
<<set _isNPC = (_partnerArg and _partnerArg.fullname and _partnerArg.gender)>>
/* If no scene is passed, create a new one */
<<if not _scene or not _scene is Object>>
<<set _scene = {
position: "start",
playerArousal: 0,
npcArousal: 0,
finished: false,
playerClimaxed: false,
npcClimaxed: false,
partner: _isNPC ? _partnerArg : null,
partnerName: _isNPC ? _partnerArg.fullname : _partnerArg,
partnerGender: _isNPC ? _partnerArg.gender : "male",
originalType: _originalType
}>>
<</if>>
/* Arousal gain per position (player, npc) */
<<set _arousalGains = {
"start": {player: 5, npc: 5},
"kissing": {player: 8, npc: 8},
"oral-give": {player: 6, npc: 12},
"oral-receive": {player: 12, npc: 6},
"hand": {player: 7, npc: 7},
"vaginal": {player: 15, npc: 12},
"anal": {player: 18, npc: 10}
}>>
<<set _partnerName = _scene.partnerName>>
<<set _partnerGender = _scene.partnerGender>>
<<set _partnerLines to ["Good girl...", "Take it all", "You're so tight", "Just like that", "Beg for it", "You feel amazing", "I'm close...", "Swallow it all", "Hold still", "So wet for me", "That's it...", "You love this", "Deeper?", "You're perfect", "Such a good slut"]>>
/* Player moans based on corruption */
<<if $corruption gte 70>>
<<set _playerMoans to $playerSexLinesCorrupt>>
<<elseif $corruption gte 30>>
<<set _playerMoans to $playerSexLinesNormal>>
<<else>>
<<set _playerMoans to $playerSexLinesPure>>
<</if>>
<div class="casual-sex-container">
<<if _scene.position == "start">>
<br><br>
<<if _dominance is "dom">>
You press <<print _partnerName>> against the wall, taking full control. <span class="player">“You're going to make this worth my time.”</span>
<<elseif _dominance is "sub">>
<<print _partnerName>> grabs your hips firmly and pushes you down. <span class="male1">“You'll earn every drop of that reward.”</span>
<<else>>
You both crash together, robes tearing in frantic need - no words, just raw hunger.
<</if>>
<</if>>
<div id="sexDisplay">
<<set _img = "">>
<<if _scene.position == "start">>
<<set _img to ["foreplay1", "foreplay2", "kissing1", "teasing", "kissing_neck", "undressing"].random()>>
Robes fall to the ground in a hurried pile. Hands roam greedily over bare skin, pulling you close as your lips meet in a heated kiss.
<<set _moan to _playerMoans.random()>><br><span class="player">"_moan"</span>
<<set _line to _partnerLines.random()>><br><span class="male1">"_line"</span>
<</if>>
<<if _scene.position == "kissing">>
<<set _img to ["kissing_deep", "kissing_intense", "kissing_bite", "neck_kiss"].random()>>
Your mouths fuse together in a fierce battle of tongues.
<<set _moan to _playerMoans.random()>><br><span class="player">"_moan"</span>
<<set _line to _partnerLines.random()>><br><span class="male1">"_line"</span>
<</if>>
<<if _scene.position == "oral-give">>
<<set _img to ["blowjob1", "blowjob2", "blowjob_deep", "kneeling_oral"].random()>>
You sink to your knees, looking up as you take his hard length into your mouth. Your tongue swirls slowly at first, then faster, drawing groans from his throat.
<<set _line to _partnerLines.random()>><br><span class="male1">"_line"</span>
<<set _moan to _playerMoans.random()>><br><span class="player">"_moan"</span>
<</if>>
<<if _scene.position == "oral-receive">>
<<set _img to ["cunnilingus1", "cunnilingus2", "facesitting_light"].random()>>
Your thighs are spread wide, his face buried between them. His tongue dances over your sensitive folds, teasing and sucking with expert precision.
<<set _moan1 to _playerMoans.random()>>
<<set _moan2 to _playerMoans.random()>><br><span class="player">"_moan1 _moan2"</span>
<<set _line to _partnerLines.random()>><br><span class="male1">"_line"</span>
<</if>>
<<if _scene.position == "hand">>
<<set _img to ["handjob1", "handjob2", "mutual_touch", "hand_stroke"].random()>>
Hands wrap around each other, stroking and teasing slick, heated flesh. Fingers slide and pump in perfect rhythm, building tension with every touch.
<<set _moan to _playerMoans.random()>><br><span class="player">"_moan"</span>
<<set _line to _partnerLines.random()>><br><span class="male1">"_line"</span>
<</if>>
<<if _scene.position == "vaginal" and ["full", "vaginal"].includes(_mode)>>
<<set _img to ["missionary", "missionary2","missionary3", "cowgirl1", "doggy1", "doggy","standingsex", "standingsex1", "missionary_intense", "cowgirl_grind"].random()>>
<<print _partnerName>> slides deep into your dripping pussy with powerful thrusts. Each stroke fills you completely, hitting every sensitive spot as the pace turns frantic.
<<set _moan1 to _playerMoans.random()>>
<<set _moan2 to _playerMoans.random()>><br><span class="player">"_moan1 _moan2 Yes-!"</span>
<<set _line to _partnerLines.random()>><br><span class="male1">"_line"</span>
<</if>>
<<if _scene.position == "anal" and ["full", "anal"].includes(_mode)>>
<<set _img to ["anal1", "anal_doggy", "anal_standing"].random()>>
He slowly presses into your tight rear entrance. The stretch is intense, overwhelming - he gives you a moment, then begins thrusting deeper and harder.
<<set _moan to _playerMoans.random()>><br><span class="player">"_moan It's too much... ahh!"</span>
<<set _line to _partnerLines.random()>><br><span class="male1">"_line"</span>
<</if>>
<<if _img neq "">>
<img @src="'images/Sex/' + _img + '.webp'" class="nsfw-glow">
<<SexDescription _img _partnerName _dominance>>
<</if>>
</div>
<<if not _scene.finished>>
/* Display current arousal */
<div class="arousal-info" style="font-size:0.8em; opacity:0.7;">
Your arousal: <<print _scene.playerArousal>> / $maxArousal<br>
<<print _partnerName>>'s arousal: <<print _scene.npcArousal>> / $maxArousal
</div>
/* Check if climax is triggered */
<<set _climaxReady = _scene.playerArousal >= $maxArousal or _scene.npcArousal >= $maxArousal>>
<<if not _climaxReady>>
/* Still in the scene – show links to change positions */
<p><strong>Continue...</strong></p>
<ul>
<<if _scene.position neq "">><li><<linkreplace "Continue in this position">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains[_newScene.position].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains[_newScene.position].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li><</if>>
<<if ["foreplay", "full"].includes(_mode) and _scene.position neq "kissing">>
<li><<linkreplace "Passionate kissing">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "kissing">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["kissing"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["kissing"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
<<if ["oral", "full"].includes(_mode)>>
<<if _scene.position neq "oral-give">>
<li><<linkreplace "Give oral">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "oral-give">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["oral-give"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["oral-give"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
<<if _scene.position neq "oral-receive">>
<li><<linkreplace "Receive oral">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "oral-receive">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["oral-receive"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["oral-receive"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
<</if>>
<<if ["hand", "full"].includes(_mode) and _scene.position neq "hand">>
<li><<linkreplace "Manual play">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "hand">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["hand"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["hand"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
<<if ["vaginal", "full"].includes(_mode) and _scene.position neq "vaginal">>
<li><<linkreplace "Vaginal penetration">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "vaginal">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["vaginal"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["vaginal"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
<<if ["anal", "full"].includes(_mode) and _scene.position neq "anal">>
<li><<linkreplace "Anal penetration">>
<<set _newScene = Object.assign({}, _scene)>>
<<set _newScene.position = "anal">>
<<set _newScene.playerArousal = Math.min($maxArousal, _newScene.playerArousal + _arousalGains["anal"].player)>>
<<set _newScene.npcArousal = Math.min($maxArousal, _newScene.npcArousal + _arousalGains["anal"].npc)>>
<<replace "#casualSexContainer">><<CasualSex _partnerArg _reason _dominance _mode _return _newScene _originalType>><</replace>>
<</linkreplace>></li>
<</if>>
</ul>
<<else>>
/* Climax phase */
<<set _playerClimaxed = _scene.playerArousal >= $maxArousal>>
<<set _npcClimaxed = _scene.npcArousal >= $maxArousal>>
<<if _playerClimaxed and _npcClimaxed>>
<<set _climaxType = "mutual">>
<<elseif _playerClimaxed>>
<<set _climaxType = "player">>
<<else>>
<<set _climaxType = "npc">>
<</if>>
<div id="climax-options">
<<if _climaxType is "mutual">>
<<linkreplace "Climax together">>
<<replace "#casualSexContainer">>
<div id="sexDisplay">
<<set _img to ["mutual_climax1", "mutual_climax2"].random()>>
<img @src="'images/Sex/' + _img + '.webp'" class="nsfw-glow">
You both lose control at the same moment - bodies locked, trembling in shared ecstasy as waves of pleasure crash through you.
<<set _moan to _playerMoans.random()>><br><span class="player">"_moan"</span>
<<set _line to _partnerLines.random()>><br><span class="male1">"_line"</span>
<br><br>Breathless and spent, the deal is sealed.
</div>
<br><<link "Return">><<FinishScene _scene.partner _scene.originalType "mutual" _return>><</link>>
<</replace>>
<</linkreplace>>
<<elseif _climaxType is "player">>
<<linkreplace "Climax on your own">>
<<replace "#casualSexContainer">>
<div id="sexDisplay">
<<set _img to ["climax_player1", "climax_player2"].random()>>
<img @src="'images/Sex/' + _img + '.webp'" class="nsfw-glow">
Your body arches, a cry escaping your lips as you reach your peak alone.
<<set _moan to _playerMoans.random()>><br><span class="player">"_moan"</span>
<<set _line to _partnerLines.random()>><br><span class="male1">"_line"</span>
<br><br>You collapse, sated.
</div>
<br><<link "Return">><<FinishScene _scene.partner _scene.originalType "player_first" _return>><</link>>
<</replace>>
<</linkreplace>>
<<elseif _climaxType is "npc">>
<<if _dominance is "dom">>
<<linkreplace "Force them to finish inside">>
<<replace "#casualSexContainer">>
<div id="sexDisplay">
<<set _img to ["creampie1", "creampie2", "missionary_creampie"].random()>>
<img @src="'images/Sex/' + _img + '.webp'" class="nsfw-glow">
<<print _partnerName>> groans and you force them deep, feeling them pulse as they fill you.
<<SexDescription _img _partnerName _dominance>>
<<set _moan to _playerMoans.random()>><br><span class="player">"_moan"</span>
<br><br>You've claimed them.
</div>
<br><<link "Return">><<FinishScene _scene.partner _scene.originalType "forced_by_player" _return>><</link>>
<</replace>>
<</linkreplace>>
<<else>>
<<linkreplace "Let them finish">>
<<replace "#casualSexContainer">>
<div id="sexDisplay">
<<set _img to ["creampie1", "creampie2", "missionary_creampie"].random()>>
<img @src="'images/Sex/' + _img + '.webp'" class="nsfw-glow">
<<print _partnerName>> releases inside you, their warmth spreading.
<<SexDescription _img _partnerName _dominance>>
<<set _moan to _playerMoans.random()>><br><span class="player">"_moan"</span>
<<set _line to _partnerLines.random()>><br><span class="male1">"_line"</span>
<br><br>It's over.
</div>
<br><<link "Return">><<FinishScene _scene.partner _scene.originalType "npc_first" _return>><</link>>
<</replace>>
<</linkreplace>>
<</if>>
<</if>>
</div>
<</if>>
<</if>>
/* Virginity loss */
<<if _scene.position == "vaginal" and $virginity == 1>>
<<set $virginity to 0>>
<<set $virginityLost to _partnerName>>
<span class="red">You lost your virginity to <<print _partnerName>>!</span><br>
<</if>>
<<if _scene.position == "anal" and $analVirginity == 1>>
<<set $analVirginity to 0>>
<<set $analVirginityLost to _partnerName>>
<span class="red">You lost your anal virginity to <<print _partnerName>>!</span><br>
<</if>>
</div>
<</widget>>
<<widget "SexDescription">>
<<set _img to $args[0]>>
<<set _partner to $args[1]>>
<<set _dominance to $args[2] ?? "neutral">>
<<set _d to "">>
/* FOREPLAY SECTIONS */
<<if ["foreplay1", "foreplay2"].includes(_img)>>
<<if _dominance is "dom">>
<<set _d to "You shove " + _partner + " against the wall, taking what you want. Your hands roam his body, commanding his responses as you rub your core against his hardening length.">>
<<else>>
<<set _d to either(
_partner + " slams you against the wall, his heavy palms pinning your wrists while his knee shoves between your thighs to force them apart. He doesn't bother with your robes, instead sliding his rough hands inside the fabric to mash and squeeze your breasts until your nipples are bruised and hard. You can feel the thick, rigid length of his cock rubbing against your hip through his pants, radiating a heat that makes your own core start to leak through your undergarments.",
"He pulls you onto his lap, his fingers digging into the meat of your thighs with enough force to leave marks. His hands wander greedily under your layers, mapping the curve of your ass and the swell of your heat without taking a single stitch of clothing off. Every time you shift, you feel his massive erection grinding against your entrance, the friction through the silk layers only making the ache in your pussy more demanding and heavy.",
_partner + " grips the back of your neck and forces your chest against his, his other hand sliding down to grope you through your robes. He mashes his palm against your mound, rubbing in heavy, circular motions that grind the fabric against your clit. He breathes his hot, stinking hunger into your ear, telling you exactly how wet you're getting for him as he continues to maul your body with his calloused hands."
)>>
<</if>>
<<elseif _img is "teasing">>
<<set _d to either(
"He slides a finger along the slit of your pussy, coating it in your own thick juices but refusing to push inside. He watches your hips jerk and your back arch with a predatory smirk, enjoying the way your muscles twitch in a desperate attempt to pull him in. He continues to circle your sensitive nub with a slick finger, applying just enough pressure to keep you on the edge of a scream without giving you the release you're begging for.",
_partner + " leans down to bite your inner thigh, his breath hot against your soaking wet folds. He uses his thumb to spread your labia wide, exposing your swollen clit to the cool air before flicking it once, hard. You sob and try to close your legs around his head, but he grips your knees and holds you open, mocking your desperation as he continues to tease your entrance with the tip of his finger without ever providing full penetration."
)>>
<<elseif ["kissing_neck", "neck_kiss"].includes(_img)>>
<<set _d to either(
"He buries his face in the crook of your neck, sucking the skin so hard you can feel the capillaries bursting under his tongue. He isn't being gentle; he uses his teeth to nip and tear at your throat, leaving dark, jagged marks that will last for days. His hands are busy mauling your waist, pulling you into his hard frame so you can feel every twitch of his cock against your stomach while he continues to devour your neck.",
_partner + " tilts your head back to expose the full length of your throat, his mouth landing on your skin with a wet, heavy suction. He licks a path from your jaw down to your collarbone, his teeth scraping against your flesh as he claims you. You can hear the wet sounds of his mouth against your skin as he leaves a trail of bruises, his breath coming in ragged, guttural hitches that vibrate through your entire body."
)>>
/* ORAL SECTIONS */
<<elseif ["blowjob1", "blowjob2", "kneeling_oral"].includes(_img)>>
<<set _d to either(
"You sink to your knees and wrap your lips around his thick, pulsing shaft, sliding down until your nose is buried in his pubic hair and his head hits the back of your throat. You use your hands to stroke the base of his cock while your mouth works the top, your saliva slicking the entire length until it glistens. Each time you slide up, you use your tongue to swirl around the rim of his head, catching the salty pre-cum that leaks out as he growls and shoves his hips forward into your face.",
"Your mouth is stretched to its limit as you take the full circumference of " + _partner + "'s cock. You bob your head in a steady, rhythmic pace, the wet slapping sound of your lips hitting his thighs filling the silence. You can taste the musk and salt on your tongue as you swallow his length over and over, your eyes looking up at him to watch his composure crumble. He reaches down to tangle his fingers in your hair, guiding your head with increasing urgency as he gets closer to the edge."
)>>
<<elseif _img is "blowjob_deep">>
<<set _d to either(
"You relax your throat and let " + _partner + " shove his entire length deep into your gullet, the thick head of his cock pressing against your esophagus. Your eyes water and your nose runs from the intense stretch, but you don't pull away; you swallow around him, the constriction of your throat muscles drawing a strangled, high-pitched moan from his lips. He slams his hips forward, bottoming out in your throat again and again until you're gagging on his heat.",
"He grips your hair tightly and shoves himself deep, forcing you to take every inch of his rigid shaft. You can feel the pulses of his blood through his cock as it fills your throat completely. You wrap your hand around the very base, squeezing hard to keep the blood trapped in his head while you continue to service him with deep, lung-busting thrusts that leave you breathless and drooling."
)>>
/* VAGINAL SECTIONS */
<<elseif ["missionary1", "missionary_intense"].includes(_img)>>
<<if _dominance is "dom">>
<<set _d to "You straddle him, taking him inside you on your own terms. You set the agonizingly slow pace, making him beg before you finally slam down, seating him to the hilt.">>
<<else>>
<<set _d to either(
_partner + " pins your legs back against your chest and drives into you with a heavy, meat-on-meat thud. Each stroke is a violent intrusion, his thick shaft stretching your pussy to its absolute limit before pulling out almost entirely and slamming back in. You can feel the heat of his balls slapping against your ass and the friction of his pubic bone grinding into yours, his weight crushing the air from your lungs as he pounds you into the bedding with raw, animalistic force.",
"He buries his cock into you with one long, agonizingly deep lunge that hits your cervix, making your vision blur. He doesn't slow down, instead building a frantic rhythm that has your bodies sliding against each other in a mess of sweat and juices. Each time he thrusts, you feel his shaft rubbing against your inner walls, hitting every sensitive spot with a heavy pressure that turns your moans into broken, rhythmic gasps. He is claiming you completely, his hands digging into your shoulders to keep you still for his assault."
)>>
<</if>>
<<elseif _img is "doggy1">>
<<set _d to either(
"You're on your hands and knees, your ass pushed back to meet " + _partner + "'s crotch as he slams into you from behind. The angle allows him to hit the deepest parts of your pussy, each thrust making your stomach churn with the sheer depth of it. He grips your hips with a bruising force, his fingers leaving marks in your skin as he uses your body like a tool, his cock sliding in and out of your soaking wet entrance with a loud, wet slapping sound that echoes in the room.",
"He bends you over and shoves himself into you, his hands reaching around to squeeze and pull at your breasts while he pounds away at your ass. Each time he lunges forward, you're shoved further onto the bed, your body vibrating from the impact. He doesn't care about your comfort; he only cares about the friction and the heat, his breathing coming in heavy, jagged snorts as he pursues his own release through the relentless battering of your core."
)>>
/* ANAL SECTIONS */
<<elseif ["anal1", "anal_doggy", "anal_standing"].includes(_img)>>
<<set _d to either(
_partner + " ignores your initial gasps of pain and shoves his thick head into your tight rear. He doesn't wait for you to adjust, instead forcing his way in inch by inch until he is buried to the hilt. The stretch is overwhelming, a burning fullness that occupies your entire lower body. He begins to move with short, sharp stabs, his cock stretching your internal muscles as he forces your body to accept the intrusion, his hands pinning you down to prevent any escape.",
"The sensation of being filled in your ass is absolute. " + _partner + " drives into your rear with a heavy, rhythmic pressure that makes your entire body shake. You can feel the ridges of his cock stretching your tightest muscles, the friction generating a localized heat that eventually turns the pain into a dull, throbbing ache. He doesn't use any finesse; he simply hammers away at your backside, his fingers digging into your hips to maintain the brutal angle of his entry."
)>>
/* FINISHES */
<<elseif ["creampie1", "creampie2", "missionary_creampie"].includes(_img)>>
<<set _d to either(
_partner + " jerks violently as he reaches his limit, slamming his cock into you as deep as it can go and holding it there. You feel the first hot jet of his seed hit your cervix, followed by pulse after pulse of thick, viscous fluid that fills your pussy to the brim. The heat is intense, a localized fire inside your womb as he empties himself into you, the excess cum beginning to leak out of your stretched entrance and coat your thighs as he slowly softens.",
"He lets out a guttural roar and shoves himself into you one last time, pinning you down as his cock twitches and sprays his hot release deep inside your core. You can feel your own internal muscles clenching around him, trying to squeeze every drop out of his shaft as he floods you. He stays buried inside you for a long minute, his heavy breathing the only sound as you feel the warmth of his seed pooling inside you, marking you internally with his scent and fluid."
)>>
<<elseif ["cum_in_mouth1", "swallow"].includes(_img)>>
<<set _d to either(
"He rips his cock out of your pussy and shoves it into your mouth just as he starts to blow. Thick, hot ropes of cum hit the back of your throat, forcing you to swallow rhythmically to avoid choking. You take every bit of it, the bitter, salty taste coating your tongue as he continues to pump his release down your gullet. He doesn't pull out until he's completely drained, leaving you with a mouthful of his spent seed which you swallow with a heavy, audible gulp.",
_partner + " shoves his cock deep into your mouth and releases, the hot spurts of his climax filling your oral cavity. You use your tongue to catch the ropes of white fluid, swallowing them down as they arrive. He mashes his crotch against your face, forcing you to take every drop until his cock finally goes limp in your mouth, leaving a messy trail of cum on your lips and chin as he finally pulls away."
)>>
<<elseif ["cum_on_chest1", "cum_on_feet1", "cum_on_belly1", "cum_on_chest2", "cum_on_belly2", "cum_on_feet2"].includes(_img)>>
<<set _d to "He jerks himself off over your body, his breathing coming in short, sharp bursts until he finally releases. Thick, white ropes of cum splatter across your skin, landing with a wet sound and sticking to you instantly. He watches with a look of pure satisfaction as his seed decorates your body, the warmth of the fluid slowly cooling as it drips down your curves. He doesn't offer to clean you; he simply lets his release sit there, a visible mark of his pleasure and your use.">>
<</if>>
<<if _d neq "">>
<br><span class="sex-desc">_d</span>
<</if>>
<</widget>><div class="hstatus-container">
<h2 class="hstatus-title">Yin Essence Record</h2>
<p class="hstatus-subtitle">Secret chronicles of your body's refinement...</p>
<div class="hstatus-content">
<!-- Virginity Status -->
<div class="hstatus-section virginity">
<div class="hstatus-label">Purity Seal</div>
<<if $virginity eq 1>>
<div class="hstatus-value pristine">
<strong>Intact</strong><br>
<span class="hstatus-desc">Your primal yin remains sealed — a treasure coveted by dual cultivators.</span>
</div>
<<else>>
<div class="hstatus-value defiled">
<strong>Broken</strong><br>
<span class="hstatus-desc">First taken by: <em><<print $virginityLost>></em><br>
The memory lingers in your meridians like lingering yang fire.</span>
</div>
<</if>>
</div>
<!-- Anal Virginity (Optional - Add if you track it) -->
<<if $analVirginity eq 0>>
<div class="hstatus-section">
<div class="hstatus-label">Rear Path</div>
<<if $analVirginity eq 1>>
<div class="hstatus-value pristine">Untouched</div>
<<else>>
<div class="hstatus-value defiled">Explored by: <<print $analVirginityLost>></div>
<</if>>
</div>
<</if>>
<!-- Sex Fame -->
<div class="hstatus-section">
<div class="hstatus-label">Carnal Renown</div>
<div class="hstatus-value fame">
<<print $sexFame>><br>
<<if $sexFame gte 500>>
<span class="hstatus-desc">A seductress whispered of in forbidden tales.</span>
<<elseif $sexFame gte 200>>
<span class="hstatus-desc">Your allure draws hungry eyes across the realms.</span>
<<elseif $sexFame gte 50>>
<span class="hstatus-desc">Rumors of your beauty begin to spread.</span>
<<else>>
<span class="hstatus-desc">Still a hidden lotus, waiting to bloom.</span>
<</if>>
</div>
</div>
<!-- Add more lewd stats here later (corruption effects, dual cultivation count, etc.) -->
</div>
<div style="text-align:center; margin-top:30px;">
<<link "Return" $passage>><</link>>
</div>
</div><<widget "MortalRealm">>
<<if $playerX >= 6 && $playerX <= 9 && $playerY >= 6 && $playerY <= 8>> <<set $region to "Hundred Sorrows Mountain">> <p>You ascend the mist-shrouded slopes of <b>Hundred Sorrows Mountain</b>. The air grows heavy with resentment, and each breath tastes like regret. Twisted trees cling to black stone, and the wind carries faint, weeping cries that never seem to stop.</p>
<p>Legends say this place remembers every death that occurred here — and there were many. Vengeful spirits, corrupted beasts, and mad cultivators roam freely, drawn to the sorrowful qi that saturates the soil.</p>
<p>This cursed peak does not forgive mistakes. </p>
<<link "Hunt demonic beasts" "HuntBeasts|Region1">><<set $passage to passage()>>
<<set $region to "Hundred Sorrows Mountain">>
<</link>>
<<elseif $playerX == 2 and $playerY == 12>>
<p>As you crest the final hill, the mist begins to part—revealing the modest yet vibrant town of <b>Jade Creek</b>. Wooden buildings with curved roofs nestle beside a flowing stream, and the faint scent of incense lingers in the air. It may not be a grand city, but it hums with quiet energy and the presence of cultivators.</p>
<<link "Enter town" "Jade Creek Town">>
<<set $region to "Jade Creek Town">>
<</link>>
<<elseif $playerX <= 2 and $playerX >= 1 and $playerY >= 5 and $playerY <= 6>>
<p>Before you stands the <b>Clear Sky Azure Dragon Pavilion</b>. Its high stone walls are etched with ancient calligraphy, and the pavilion’s blue-tiled roofs shimmer faintly under the sunlight, as if resonating with spiritual energy. Disciples in azure robes move with quiet discipline, their presence exuding a calm but formidable aura. This place is both sanctuary and stronghold—a beacon of order in a chaotic world.</p>
<<set $region to "Clear Sky Azure Dragon Pavilion">>
<<link "Enter sect" "ClearSkyAzureDragonPavilion">><</link>>
<<elseif $playerX eq 11 && $playerY eq 8>>
<p>As you approach the far edge of this realm, the world around you shifts. The winds still, the sky dims slightly — and before you stands a shimmering barrier of spiritual force, pulsing faintly like a living thing.</p>
<p>This is the <b>Boundary of Realms</b> — a powerful seal that separates the Lower Realms from what lies beyond: a vast and dangerous world where the true powers reside. It is said that the main branches of the great sects — those with influence stretching across generations — are located past this very barrier.</p>
<p>Beyond it roam cultivators of unimaginable strength, ancient beasts, and lands steeped in primordial energy. The difference in pressure alone makes your qi tremble in your dantian.</p>
<p>A weathered inscription glows softly on a nearby stone: <i>"Only those who have tempered their spirit and transcended the mortal coil may tread the path beyond."</i></p>
<p>For now, the barrier rejects your presence. Your journey in this realm is not yet finished.</p>
<<elseif $playerX >= 0 && $playerX <= 5 && $playerY >= 2 && $playerY <= 3>>
<p>You step into the arid expanse known as <b>Blood Sand Reach</b>. The scorching wind carries the scent of iron, and the sun beats down on dunes stained red — not by mineral, but by centuries of battle.</p>
<p>Whispers tell of rogue cultivators and desert beasts lurking beneath the sands, drawn to the qi of trespassers. This is no place for the unprepared — tread carefully, for death hides in the heat haze.</p><<set $region to "Blood Sand Reach">>
<<link "Hunt demonic beasts" "HuntBeasts|Region1">><<set $passage to passage()>><</link>>
<<elseif $playerX >= 8 && $playerX <= 9 && $playerY >= 2 && $playerY <= 3>>
<p>Arriving at <strong>Northern Phoenix City</strong>, you are greeted by the rhythmic bustle of trade, the scent of incense, and the majestic outline of phoenix-shaped architecture glinting under the sky.</p>
<p>This northern stronghold is a center of commerce and cultivation alike — a meeting place of travelers, wandering cultivators, and the influential sects who hold sway in these lands.</p>
<<set $region to "Northern Phoenix City">>
<<elseif $playerX eq 3 and $playerY eq 9>>
You stumble upon the Lone Mountain.
Rising in solemn silence, this solitary mountain pierces the clouds — untouched, undisturbed. The wind here carries no whispers, only peace. As you step forward, you feel the weight of countless journeys that led you here.
<<link "Enter" "LonePeak">><</link>>
<<elseif $playerX >= 9 && $playerX <= 10 && $playerY >= 11 && $playerY <= 12>>
<p>You've reached the shadowed grounds of the <strong>Ghost King Netherworld Sect</strong> — a feared branch of an even more powerful sect residing deep within the Upper Realms.</p>
<p>The air here is cold and heavy, despite the lack of wind. Black banners flutter from bone-crafted spires, and pale disciples move silently like ghosts, their eyes empty of compassion.</p>
<<link "Enter sect" "GhostKingNetherworldSect">><</link>>
<<set $region to "Ghost King Netherworld Sect">>
<<else>>
<<set $region to "World Map">><<set $npcFinished>>
<</if>>
<</widget>>
<!--=================-
======================
=====================
=========================TOURNAMENT WIDGETS==========--><<widget "MainStorylineWidget">>
<<if $mainStageStarted eq "false">>
<<set _chance to random(0,100)>>
<<if _chance gt 50>>
As you move through the dense forest on the map, something unusual catches your eye. A faint glow pulses from behind a cluster of ancient rocks nearby.
Do you want to investigate?
<<link "Yes" "MainMissionStart">><<set $pe to 0>><</link>>
<</if>>
<</if>>
<<if $mainStageStarted eq "true" and $mainStage eq 0>>
<<set _chance to random(0,100)>>
<<if _chance gt 50>>
As you wander through region, you feel strange energy in the air, as if it were calling out to you...
Do you want to investigate?
<<link "Yes" "MainMissionStart">><<set $pe to 0>><</link>>
<</if>>
<</if>>
<</widget>><!--__________________________________________________________________________________________
_________________________ Patrol Perimeter Mission__________________________________________________________________________________________
_________________________ -->
<<widget "PatrolPerimeter01">>
<<if $pe eq 0>>
You arrive at the eastern gate just as dusk cloaks the sect in fading twilight. A pair of lanterns sway gently at the entrance, and a small patrol team awaits-swords at their hips, eyes sharp.
You're assigned to a route along the outer spiritual barrier. It’s quiet… maybe too quiet.
<<CreateNPC001>><<set $juniorNPC to clone(_npc)>>
<<set _roll to random(1,5)>>
<<if _roll gte 2>>
As you near a bend in the forest path, something catches your eye. You notice fresh claw marks gouged into a tree trunk near the barrier. Whatever made them had strength - and didn’t belong near the sect.
<<if _npc.gender eq "female">><span class="female">“Senior Sister… are those demonic beast marks?”</span> the _npc.fullname asks, glancing around nervously.<<else>><span class="male1">“Senior Sister… are those demonic beast marks?”</span> the _npc.fullname asks, glancing around nervously.<</if>>
You can choose to:
You kneel and inspect the grooves. They're fresh-no older than a few hours. Blood specks darken the roots nearby.
<div id="choice">
<<link "Track the marks deeper into the woods">>
<<replace "#choice">>
You and your partner draw your weapons and begin following the faint trail of blood. The forest grows darker, qi in the air distorted.
Suddenly, a low growl echoes ahead. A <b>Shadowtail Beast</b> emerges-sleek, dark-furred, its eyes glowing violet.
<<ShadowtailBeast>>
<<link "To battle!" "MissionBattle1">><<set $passage to "MissionBattle1">><<set $returnpassage to "MissionWidgets">><<set $pe to 0>><<BeforeBattle>><<set $nextPe to 4>><</link>>
<</replace>>
<</link>>
<<link "Return and report">>
<<replace "#choice">>
You mark the tree with a talisman and hurry back to report.
The sect elders nod approvingly.
<span class="male1">“Good instincts. Better to alert us than to act blindly.”</span>
<<MissionFinish>>
<</replace>>
<</link>>
<<link "Set up an ambush">>
<<replace "#choice">>
You and your junior lie in wait near the tree, using a minor qi concealment technique. Hours pass. Finally, the beast returns - sniffing near the blood trail.
With perfect timing, you and the junior leap from the shadows and strike.
<<MissionFinish>>
<</replace>>
<</link>>
</div>
<<elseif $pe eq 1>>
xianxia
<<else>>
One of the junior disciples paired with you is a known flirt. As you patrol the bamboo-lined path,<<if _npc.gender eq "female">>she<<else>>he<</if>> walks a little too close, brushing against your shoulder now and then.
<<if _npc.gender eq "female">><span class="female">“Cold night, isn’t it?” she says, voice low. <span class="female">“We could... keep each other warm while we watch the perimeter. I wouldn’t mind sharing body heat with a senior like you…”</span><<else>><span class="male1">“Cold night, isn’t it?” he says, voice low. <span class="male1">“We could... keep each other warm while we watch the perimeter. I wouldn’t mind sharing body heat with a senior like you…”</span><</if>>
<div id="choice">
<<if $corruption gt 25>><<link "Playfully flirt back">>
<<replace "#choice">>
<span class="player">“Only if you’re brave enough to keep up with a senior sister…”</span>
He laughs softly, the sound warm and confident.
<span class="male1">“I like my odds. I’m good with my hands, after all-whether sword or… other tools.”</span>
You pause beside a tree, half-obscured by tall reeds. The sect is far behind, the perimeter ward humming faintly in the distance. No one else is around.
His hand brushes your waist lightly-waiting for you to stop him. When you don’t, his fingers slide more boldly, slipping beneath the edge of your outer robe.
<span class="male1">“May I?”</span> he whispers.
You lean back against the tree and give him a subtle nod.
He presses close, hands wandering over your body with growing confidence. His palm cups your breast through your robes, thumb flicking your nipple until it hardens beneath the fabric.
<span class="male1">“So soft… Cultivation hasn’t hardened everything, huh?”</span>
His body stays close, heat pressing against you as one hand caresses the side of your thigh, slipping higher-so close, yet not quite where you ache. His fingers toy with the edge of your undergarments, knuckles grazing tender flesh without fully touching - close enough to tease, not enough to satisfy.
<span class="male1">“You're already warm here,”</span> he murmurs, lips grazing your ear. <span class="male1">“Is this from the walk… or from me?”</span>
His fingertips finally brush your slit, slow and featherlight, just enough to make your hips twitch. He chuckles at your reaction, teasing you through the thin fabric with maddening patience.
<<set _img to ["juniorTease","juniorTease1"].random()>>
<img @src="'images/Sex/' + _img + '.webp'" width=600>
<<if $juniorNPC.internalTrait eq "Wicked" or $juniorNPC.internalTrait eq "Evil">>
He pauses, letting his hand linger just shy of your clit.
<span class="male1">“Mmm. You want it, don’t you?”</span> His voice is almost cruel in its amusement. <span class="male1">“Say it. Beg a little for your junior’s touch.”</span>
<<link "Whimper and beg him" $missionpassage>><<set $pe to 1>><</link>>
<<link "Smirk and grab his wrist" $missionpassage>><<set $pe to 2>><</link>>
<<else>>
He strokes you again, this time a little firmer, lips brushing your neck as he mutters, <span class="male1">“So sensitive… I wonder how much more you’ll take before you </span><<link "lose control." $missionpassage>><<set $pe to 3>><</link>>”
<</if>>
<</replace>>
<</link>><</if>>
<<link "Shut him down with icy elegance">>
<<replace "#choice">>
He backs off but watches you all patrol longingly.
<<MissionFinish>>
<</replace>>
<</link>>
<<link "Ignore him">>
<<replace "#choice">>
He keeps up the act but grows more cautious.
<<MissionFinish>>
<</replace>>
<</link>>
</div>
<</if>>
<<elseif $pe eq 1>>
<<PatrolPerimeter01Submissive>>
<<elseif $pe eq 2>>
<<PatrolPerimeter01Dominant>>
<<elseif $pe eq 3>>
<<PatrolPerimeter01Neutral>>
<<elseif $pe eq 4>>
After killing Shadowtail Beast and returning to the sect, you’re commended for your vigilance.
<<set $passage to "Map|Region1">>
<<MissionFinish>>
<</if>>
<</widget>>
<!--__________________________________________________________________________________________
_________________________ALCHEMY ASSIST MISSION____________________________________
__________________________________________________________________________________________-->
<<widget "AssistAlchemy01">>
<<nobr>>
<<set _roll to random(1,5)>>
<<if _roll eq 1>>
While scrubbing a cauldron, one unexpectedly lets out a puff of black smoke, covering your face in soot. The alchemist waves it off, mumbling: “Minor spiritual backfire…”
You reek of smoke and pride.
<<MissionFinish>>
<<elseif _roll eq 2>>
You misplaced Frost Lotus Root into the Yang Flame Drawer, causing the heat to spike wildly. The elder alchemist spent ten minutes shouting before calming down.
<<MissionFinish>>Fame may have slipped… like your judgment.
<<elseif _roll eq 3>>
After grinding herbs for hours, your hands and sleeves are soaked in floral spice. You’re warned the scent may cling for days.
<<MissionFinish>> You smell like alchemy - and maybe aphrodisiac.
<<elseif _roll eq 4>>
A panicked apprentice spills a yellow tonic down your robe. It clings unpleasantly, and you're told it’s “only mildly sticky.”
<<MissionFinish>> Sticky, damp, and extremely done with today.
<<elseif _roll eq 5>>
A pinkish cloud rises from the spilled powder - and you inhale without thinking.
The scent hits you fast: warm, heady, almost sweet. Then… heat.
It crawls down your throat, pools low in your belly, and spreads like fire.
Your skin prickles, your thighs press together instinctively.
A blush creeps up your face as your breathing grows shallow. You glance around - no one seems to have noticed yet.
<br> <img src="images/Sex/aphrodisiac.webp" width=600>
<br>Your nipples tighten beneath your robes. You feel wetness gathering between your legs, slick and unrelenting.
<br>The urge to rub your thighs together grows maddening.
<br>You clutch the edge of the table, trying to steady yourself.
<<MissionFinish>>
<br>If anyone noticed, they didn’t say a word… yet.
<</if>>
<</nobr>>
<</widget>>
<!--__________________________________________________________________________________________
_________________________CLEAN COURTYARD MISSION_________________________________
__________________________________________________________________________________________-->
<<widget "CleanCourtyard01">>
<<CreateNPC001>>
You begin sweeping the old courtyard. Dust rises in clouds, and the scent of wet moss clings to the air.
<<set _chance = random(1,100)>>
<<if $CurrentPcSectRank eq "Initiate">>
You notice another disciple leaning against a pillar. He eyes you without much interest.
<<if _npc.internalTrait eq "Kind">>
<<if _npc.gender eq "male">>
<span class="male1">"New here?"</span> he asks. <span class="male1">"If you need help with those weeds, just say so."</span>
<<else>>
<span class="female">"New here?"</span> she asks. <span class="female">"If you need help with those weeds, just say so."</span>
<</if>>
<<elseif _npc.externalTrait eq "Power-hungry">>
<<if _npc.gender eq "male">>
He scoffs. <span class="male1">"Menial labor suits you. Maybe you’ll learn your place."</span>
<<else>>
She scoffs. <span class="female">"Menial labor suits you. Maybe you’ll learn your place."</span>
<</if>>
<<elseif _npc.externalTrait eq "Romantic">>
<<if _chance gte 92>>
<<if _npc.gender eq "male">>
He smirks playfully. <span class="male1">"You know, sweat suits you. Maybe I’ll stick around and watch..."</span>
<<else>>
She smirks playfully. <span class="female">"You know, sweat suits you. Maybe I’ll stick around and watch..."</span>
<</if>>
<<set _npc.npcdepravity += 10>>
<</if>>
<</if>>
<<elseif $CurrentPcSectRank eq "Core Disciple" or $CurrentPcSectRank eq "True Disciple">>>
You begin sweeping when a junior disciple arrives, carrying a basket of herbs. Upon seeing you, their eyes widen.
<<if _npc.internalTrait eq "Selfish">>>
<<if _npc.gender eq "male">>
He frowns. <span class="male1">"Senior? Cleaning? Don’t you have... people for that?"</span>
<<else>>
She frowns. <span class="female">"Senior? Cleaning? Don’t you have... people for that?"</span>
<</if>>
<<elseif _npc.externalTrait eq "Vengeful">>>
<<if _npc.gender eq "male">>
He eyes you warily. <span class="male1">"I haven’t forgotten what your sect brother did to mine. Just saying."</span>
<<else>>
She eyes you warily. <span class="female">"I haven’t forgotten what your sect sister did to mine. Just saying."</span>
<</if>>
<<elseif _npc.externalTrait eq "Romantic">>>
<<if _chance gte 92>>
<<if _npc.gender eq "male">>
The disciple watches you for a while. <span class="male1">"Such elegance, even while sweeping... makes it hard to focus."</span>
<<else>>
The disciple watches you for a while. <span class="female">"Such elegance, even while sweeping... makes it hard to focus."</span>
<</if>>
<<set _npc.npcdepravity += 10>>
<</if>>
<<elseif _npc.internalTrait eq "Kind">>>
<<if _npc.gender eq "male">>
He rushes to help. <span class="male1">"Let me assist, senior! It’s the least I can do."</span>
<<else>>
She rushes to help. <span class="female">"Let me assist, senior! It’s the least I can do."</span>
<</if>>
<</if>>
<</if>>
<<MissionFinish>>
<</widget>>
<!--__________________________________________________________________________________________
_________________________JUNIOR SPAR __________________________________________________
__________________________________________________________________________________________-->
<<widget "JuniorSpar">>
<<if $pe eq 0>><<set $sparringRound = 1>><<set $playerWins = 0>><<set $juniorWins = 0>><<set _juniorWants = either("touch your thigh", "rest his hand on your chest", "feel your ass", "see your panties")>><<CreateNPC001>><<set $juniorNPC to clone(_npc)>> <<set _roll to random(0,100)>>
<<if _roll lte 85>>
You enter the courtyard. _npc.fullname grins.
<span class="male1"> "Let’s make it interesting. Wanna bet on it?"</span>
<span class="player">"What kind of bet?"</span>He smirks, clearly testing your limits.
<span class="male1">"How about this – if I win... I get to _juniorWants?"</span>
<<if $corruption gt 35>><<link "Raise the stakes" $missionpassage>><<set $pe to 1>><</link>><</if>>
<<if $corruption gt 20>><<link "Accept the bet" $missionpassage>><<set $sparBetStake to _juniorWants>><<set $pe to 3>><</link>><</if>>
<<link "Refuse" $missionpassage>><<set $sparBetStake to "none">><<set $pe to 3>><</link>>
<<else>> <<goto $missionpassage>><<set $pe to 3>><</if>>
<<elseif $pe eq 1>>
<span class="player">"Alright – but if I win, I want..."</span>
<<set _playerRaiseOptions = ["250 spirit stones", "a kiss", "you to strip shirtless"]>>
<<for _idx, _opt range _playerRaiseOptions>>
<<link _opt $missionpassage>><<set $playerBetDemand = _opt>><<set $pe to 2>><</link>>
<</for>>
<<elseif $pe eq 2>>
He whistles softly.
<span class="male1">"Bold of you."</span>
<<if $playerBetDemand eq "you to strip shirtless" or $playerBetDemand eq "a kiss">>
<<if $juniorNPC.depravity gt 30>>
<span class="male1">"Then if I win... you let me press you down for a moment."</span>
<<link "Deal" $missionpassage>><<set $sparBetStake = "press">><<set $pe to 3>><</link>>
<<link "Too much – nevermind" $missionpassage>><<set $sparBetStake to "none">><<set $pe to 3>><</link>><<set $juniorEscalate = true>>
<<else>>
<span class="male1">"That's actually too much. Let's stick to regular spar."</span>
<<link "Go to regular spar!" $missionpassage>><<set $pe to 3>><<set $sparBetStake to "none">><</link>><</if>>
<</if>>
<<elseif $pe eq 3>>
Countdown: <span id="countdown">5</span> seconds remaining!
<<silently>>
<<timed 1s>><<replace "#countdown">>4<</replace>>
<<next>><<replace "#countdown">>3<</replace>>
<<next>><<replace "#countdown">>2<</replace>>
<<next>><<replace "#countdown">>1<</replace>>
<</timed>>
<</silently>>
Round <<print $sparringRound>>
$juniorNPC.fullname circles you and makes a move...
<<set $juniorMove = either("strike", "block", "feint")>>
He prepares to $juniorMove!
Choose your response quickly!
<<link "Strike">><<set $playerMove to "strike">><<goto $missionpassage>><<set $pe to 4>><</link>>
<<link "Block">><<set $playerMove to "block">><<goto $missionpassage>><<set $pe to 4>><</link>>
<<link "Feint">><<set $playerMove to "feint">><<goto $missionpassage>><<set $pe to 4>><</link>>
<<timed 5s>>
<<set $pe to 4>>
<<set $playerMove to "none">>
<<goto $missionpassage>>
<</timed>>
<<elseif $pe eq 4>>
<<if $playerMove eq $juniorMove>>
It’s a tie! Neither of you land a hit.
<<elseif ($playerMove eq "strike" and $juniorMove eq "feint") or
($playerMove eq "block" and $juniorMove eq "strike") or
($playerMove eq "feint" and $juniorMove eq "block")>>
<<set _chance to random(0,100)>>
<<if _chance lte 10>>
<img src="images/Story/pinfall1.png" class=center width=600>
With a sharp twist, you sweep his leg and send him crashing to the ground. But your own momentum carries you forward-and you land squarely atop him.
His breath catches as your thighs straddle his hips, your hands pinning his wrists to the ground.
For a second, neither of you moves. His eyes flick down, taking in the position… the way your chest presses close… the heat of your body over his.
<span class="male1"> “W-wow… are you sure this was sparring, Senior Sister?”</span> he mutters, voice tight.
You can feel him stiffen under you - and not just from the surprise.
<</if>>
You win this round!
<<set $playerWins += 1>>
<<else>>
<<set _roll to random(0,100)>>
<<if _roll lte 10>>
<img src="images/Story/pinfall.png" class=center width=600>
You stumble from his final strike-and before you can recover, he lunges, tackling you to the ground in a clean, controlled pin.
His body presses down over yours, his breath brushing your cheek. One of his knees settles between your thighs, his hand braced right beside your head.
<span class="male1">“Looks like I win… and this view’s part of the reward?”</span> he teases, eyes flicking down to your lips, your chest, then quickly away.
<</if>>
$juniorNPC.fullname wins this round!
<<set $juniorWins += 1>>
<</if>>
<<if $playerWins gte 3>>
You’ve bested $juniorNPC.fullname
You both collapse.
<<MissionFinish>>
<<if $sparBetStake eq "none">>
He sighs and brushes your leg. <span class="male1">"A deal’s a deal."</span>
<</if>>
<<elseif $juniorWins gte 3>>
<<if $sparBetStake eq "rest his hand on your chest">>
He leans in, smirking.
<<set _roll to random(1,3)>><<if _roll eq 1>>
<span class="male1"> “You promised to be good, didn’t you?”</span>
Without waiting for permission, he places his palm directly on your chest, fingers spreading over the swell of your breast through your inner robe.
<img src="images/Sex/juniorBetTits.webp" width=600>
<span class="male1"> “So warm... Are all cultivators this soft under their armor?”</span>
You stiffen, heat blooming in your cheeks - but he doesn’t press harder, only lingers there, smug and patient.
<<if $corruption lt 16>><<set $corruption +=1>><</if>>
<<elseif _roll eq 2>>
<span class="male1">“Let me see, just a little,”</span>
He says, not even pretending to hide his hunger.
With practiced mischief, he slips his fingers under your inner robe, tugging down just enough to expose one bare breast. The cool air kisses your skin - then his hand follows.
<img src="images/Sex/juniorBetBareTit.webp" width=600>
He cups you boldly, thumbing your nipple while watching your face.
<span class="male1">“Senior Sister… you’re even more beautiful than I imagined.”</span>
Your heart pounds. You could stop him
<<if $corruption lt 16>><<set $corruption +=1>><</if>>
<<elseif _roll eq 3>>
<span class="male1"> “I won, didn’t I? I want the full view.”</span>
He doesn’t wait - both hands slide under your robes, and with a swift pull, your top falls open. Your breasts bounce free, and his eyes gleam.
<<set _img to ["juniorBetBareTits","juniorBetBareTits1","juniorBetBareTits2","juniorBetBareTits3"].random()>>
<img @src="'images/Sex/' + _img + '.webp'" width=600>
<span class="male1">“Perfect,”</span>
he murmurs, hands claiming both with greedy confidence. He squeezes, thumbs brushing over your nipples as if testing their sensitivity.
<span class="male1">“You can hit me later,”</span>
he teases.
<span class="male1">“But let me enjoy this for now…”</span>
The humiliation burns... but so does something else.
<<if $corruption lt 16>><<set $corruption +=1>><</if>>
<</if>>
<<elseif $sparBetStake eq "feel your ass">>
As you try to stand, he steps behind you and traps you gently against him.
His hand slides down your back and settles firmly on your ass, fingers kneading the flesh through your robes.
<img src="images/Sex/juniorBetAss.webp" width=600>
<span class="male1">“Soft and round,”</span>
he murmurs, giving a slow, deliberate squeeze.
<span class="male1"> “I’d say you’ve got quite the advantage here after all.”</span>
You flush, struggling to maintain your composure under his bold touch.
<<if $corruption lt 16>><<set $corruption +=1>><</if>>
<<elseif $sparBetStake eq "see your panties">>
<<set _roll to random(1,2)>>
<<if _roll eq 1>>
Before you can react, his hands are at your waist, yanking your robe up and over your hips in one swift movement.
Your panties are instantly revealed, the pale fabric clinging to your skin.
His eyes gleam with triumph as he leans closer.
<img src="images/Sex/juniorBetPanties.webp" width=600>
<span class="male1">“White… pure and innocent, huh? I didn’t think you’d hide something so sweet under all that armor.”</span>
His fingers twitch as if eager to explore more - but for now, he just watches, savoring the moment.
<<if $corruption lt 16>><<set $corruption +=1>><</if>>
<<else>>
<span class="male1">“Lift your robe,”</span>
he says, voice low and daring.
<span class="male1"> “I want to see.”</span>
Your glare only amuses him.
<<set _img to ["juniorBetPanties1", "juniorBetPanties2"].random()>>
<img @src="'images/Sex/' + _img + '.webp'" width=600>
<span class="male1">“A deal’s a deal, Senior Sister.”</span>
Reluctantly - or maybe with just a hint of curiosity - you raise the hem of your outer robe. His eyes instantly drop, widening when he sees your panties.
<span class="male1">“White, huh? Pure and pretty… just like you pretend to be.”</span>
His fingers almost brush your thigh again. <span class="male1">“Next time I win… you lose these too.”</span>
<<if $corruption lt 16>><<set $corruption +=1>><</if>>
<</if>>
<<elseif $sparBetStake eq "touch your thigh">>
He grins victoriously, stepping closer before you can protest.
<span class="male1">"A deal’s a deal, Senior Sister."</span>
His hand hovers for a heartbeat, then descends-warm fingers pressing lightly against your outer thigh.
The contact is casual at first, almost innocent… until his thumb begins tracing small, slow circles just beneath the hem of your robe.
<span class="male1">"You’re trembling,"</span> he teases, voice low and amused.
The smugness in his eyes makes it worse-he knows exactly what he’s doing, testing how far you’ll let him go.
You could pull away, but doing so would only prove how much his little victory unsettles you.
So you stand your ground, heat rising to your face as his hand lingers a second longer than necessary before finally withdrawing.
<span class="male1">"Soft,"</span> he murmurs with a smirk. <span class="male1">"I’ll remember that for next time."</span>
<<if $corruption lt 16>><<set $corruption +=1>><</if>>
<<elseif $sparBetStake eq "none">>
You both collapse, laughing. "Call it a draw?"
<</if>>
<<MissionFinish>>
<<else>>
<<set $sparringRound += 1>>
<<link "Next round!">><<goto $missionpassage>><<set $pe to 3>><</link>>
<</if>>
<</if>>
<</widget>>
<!-- __________________________________________________________________________________________
_________________________DELIVER SUPPLIES __________________________________________________
__________________________________________________________________________________________-->
<<widget "DeliverSupplies01">>
The box on your shoulder is heavier than it looks. Bottles of spirit water clink together with every step, and the scent of herbal salve clings to your robes.
The outer quarters lie far beyond the inner courtyard-humble huts built beneath the shade of ancient trees. Most who live there are injured, overworked, or too weak to progress.
As you make your rounds, a few disciples nod in gratitude. One thanks you with a crooked smile; another refuses to meet your eyes, ashamed of their status.
But at the final door, you hear muffled weeping inside. A disciple lies feverish and delirious, medicine untouched on the table beside them.
<<MissionFinish>>
<</widget>>
<!-- __________________________________________________________________________________________
_________________________TendBeasts01 __________________________________________________
__________________________________________________________________________________________-->
<<widget "TendBeasts01">>
/* 30% chance for the beast heat twist to trigger */
<<set _heatRoll to random(1, 100)>>
You arrive at the Spirit Beast Pens, carrying heavy wooden buckets of spirit-infused grain and fresh mountain spring water.
<br><br>
<<if _heatRoll <= 30>>
/* Twist Event: Beast Heat */
As you approach the enclosure, a massive Crimson-Crested Crane shrieks, its feathers ruffled and eyes glazed. It's in the middle of its mating cycle! The beast aggressively snaps its razor-sharp beak at you, its Yang energy completely out of control.
<br><br>
You are forced to burn a rare Soothing Lotus incense from the sect's supplies and carefully channel your Qi to calm the agitated beast before you can safely clean the pen. It's an exhausting, sweaty ordeal, but you manage to finish the job without losing any fingers.
<<else>>
/* Normal Event */
The Elder's Spirit Cranes are relatively docile today. You spend a peaceful, if slightly smelly, few hours feeding them, sweeping away the molted spirit feathers, and scrubbing down the stone floors of their enclosures.
<</if>>
<br><br>
<<MissionFinish>>
<</widget>>
<!-- __________________________________________________________________________________________
ScripturePavilion01 __________________________________________________
__________________________________________________________________________________________-->
<<widget "ScripturePavilion01">>
The Scripture Pavilion is perfectly quiet, smelling faintly of old bamboo and spiritual ink. You spend the afternoon diligently sorting returned jade slips into their proper elemental categories and dusting the ancient wooden racks.
<br><br>
While organizing the shelves, you accidentally activate a slightly damaged jade slip. It briefly projects a harmless, flickering illusion of an ancient sword fairy practicing a stance before fading into nothingness. A tedious chore, but surrounded by the sect's accumulated knowledge, it feels surprisingly peaceful.
<br><br>
<<MissionFinish>>
<</widget>>
<!-- __________________________________________________________________________________________
DormDisturbance01 __________________________________________________
__________________________________________________________________________________________-->
<<widget "DormDisturbance01">>
You patrol the Outer Disciple dormitories late at night, investigating the Elder's complaints of "strange, rhythmic thumping and suppressed noises" echoing through the courtyards.
<br><br>
Tracing the sound to a secluded storage shed behind the alchemy labs, you peek through a crack in the bamboo wall. Inside, illuminated by the soft glow of a night pearl, are a Junior Brother and Junior Sister deeply engaged in unorthodox Yin-Yang dual cultivation, completely ignoring sect curfew!
<br><br>
<span id="dorm-choices">
<<link "Report them to the Discipline Hall">>
<<replace "#dorm-choices">>
You loudly clear your throat and kick the door open, causing them to shriek and scramble for their scattered robes. You confiscate their identity tokens and officially report them to the Elder. Your strict adherence to sect rules earns you the Elder's praise, though the outer disciples will surely curse your name.
<br><br>
<<MissionFinish>>
<</replace>>
<</link>>
<br>
<<link "Blackmail them for resources">>
<<replace "#dorm-choices">>
You tap a rhythm on the door and demand a "privacy fee" to look the other way. Flustered and terrified of expulsion, they quickly pool together their monthly stipend of spirit stones and slide it under the door. You walk away with heavier pockets and a smug smile.
/* Optional: Add a line here to increase player money/spirit stones, e.g., <<set $spiritStones += 20>> */
<br><br>
<<MissionFinish>>
<</replace>>
<</link>>
<br>
<<link "Offer to 'assist' their cultivation (Join)">>
<<replace "#dorm-choices">>
You step inside, calmly locking the door behind you. Pointing out the dangerous flaws in their chaotic Qi circulation, you graciously offer to act as a mediating third party to balance their Yin and Yang. What follows is an intense, breathless night of "hands-on tutoring." You return to the mission board exhausted, but your meridians feel incredibly satisfied.
/* Optional: Add a line here to increase player lust, corruption, or cultivation base */
<br><br>
<<MissionFinish>>
<</replace>>
<</link>>
</span>
<</widget>><<widget "PatrolPerimeter01Submissive">>
<<nobr>>
<<set $missionpassage = $args[0] ?? $passage>>
/* Mission‑specific effects */
<<set $currentMissionEffects = {
corruption: random(3,5),
sexFame: 4,
righteousreputation: -2,
logTitle: "Mission Submission",
logDesc: "You submitted to a junior during a patrol, deepening your corruption."
}>>
<<set $missionDominance = "sub">>
<<set _partner = $juniorNPC>>
<<set $sexType = "mission_sex">>
<<set $sexReturnPassage = $missionpassage>>
<<goto "EncounterInteractionSex">>
<</nobr>>
<</widget>>
<<widget "PatrolPerimeter01Dominant">>
<<nobr>>
<<set $missionpassage = $args[0] ?? $passage>>
/* Mission‑specific effects */
<<set $currentMissionEffects = {
corruption: random(2,4),
sexFame: 4,
righteousreputation: -2,
logTitle: "Mission Dominance",
logDesc: "You took control of a junior during a patrol, asserting your authority."
}>>
<<set $missionDominance = "dom">>
<<set _partner = $juniorNPC>>
<<set $sexType = "mission_sex">>
<<set $sexReturnPassage = $missionpassage>>
<<goto "EncounterInteractionSex">>
<</nobr>>
<</widget>>
<<widget "PatrolPerimeter01Neutral">>
<<nobr>>
<<set $missionpassage = $args[0] ?? $passage>>
/* Mission‑specific effects */
<<set $currentMissionEffects = {
corruption: random(2,4),
sexFame: 4,
righteousreputation: -2,
logTitle: "Mission Indulgence",
logDesc: "You shared an intimate moment with a junior during a patrol."
}>>
<<set $missionDominance = "neutral">>
<<set _partner = $juniorNPC>>
<<set $sexType = "mission_sex">>
<<set $sexReturnPassage = $missionpassage>>
<<goto "EncounterInteractionSex">>
<</nobr>>
<</widget>><<widget "BackgroundHandler">>
<<if $backgroundClass eq "tavern">>
<img src="images/Background/tavern.jpg" style="width: 100%; display: block;">
<<elseif $backgroundClass eq "tavernRoom">>
<<set $random=random(1,2)>>
<<if $random eq 1>>
<img src="images/Background/tavernRoom.jpg" style="width: 100%; display: block;">
<<elseif $random eq 2>>
<img src="images/Background/tavernRoom1.jpg" style="width: 100%; display: block;">
<</if>>
<<else>>
<<set $random=random(1,10)>>
<<if $random eq 1>>
<img src="images/Background/bamboo_forest.jpg" style="width: 100%; display: block;">
<<elseif $random eq 2>>
<img src="images/Background/bamboo_forest1.jpg" style="width: 100%; display: block;">
<<elseif $random eq 3>>
<img src="images/Background/mountain_top.jpg" style="width: 100%; display: block;">
<<elseif $random eq 4>>
<img src="images/Background/mountain_top1.jpg" style="width: 100%; display: block;">
<<elseif $random eq 5>>
<img src="images/Background/plumgrove.jpg" style="width: 100%; display: block;">
<<elseif $random eq 6>>
<img src="images/Background/plumgrove1.jpg" style="width: 100%; display: block;">
<<elseif $random eq 7>>
<img src="images/Background/waterfall.jpg" style="width: 100%; display: block;">
<<elseif $random eq 8>>
<img src="images/Background/waterfall1.jpg" style="width: 100%; display: block;">
<<elseif $random eq 9>>
<img src="images/Background/forest.jpg" style="width: 100%; display: block;">
<<elseif $random eq 10>>
<img src="images/Background/forest1.jpg" style="width: 100%; display: block;">
<</if>><</if>>
<</widget>><<widget "BeforeBattle">>
<<set _enemy = $args[0] ?? _npc>>
<<set $currentEnemy to clone(_enemy)>>
<<set $currentEnemy.NPCcurrenthealth to $currentEnemy.NPCmaxhealth>>
<<set $currentEnemy.NPCcurrentenergy to $currentEnemy.NPCmaxenergy>>
<<set $battleWon = false>>
<<set $defeatedEnemy = null>>
<<set $playerLost = false>>
<<set $returnpassage to passage()>>
<</widget>>
<<widget "PlayerAttackAttempt">>
<<set _hitChance = 50 + ($agility - $currentEnemy.NPCagility)>>
/* clamp */
<<set _hitChance = Math.max(10, Math.min(90, _hitChance))>>
<<set _roll = random(1,100)>>
<<if _roll <= _hitChance>>
<<set $playeraction = "attack success">>
<<else>>
<<set $playeraction = "attack failure">>
<br>─── ⚔️ ───<br>
<</if>>
<</widget>>
<<widget "PlayerAttackDamage">>
<<set $playermindamage = Math.round($atk * 0.8)>>
<<set $playermaxdamage = Math.round($atk * 1.2 + ($basestrength / 3) + ($martialArts / 4))>>
<<set $playerdamageroll = random($playermindamage, $playermaxdamage)>>
<<set $playerdamagerolltotal = $playerdamageroll + ($basestrength / 2)>>
<<set $damagetoenemy = Math.round($playerdamagerolltotal - $currentEnemy.NPCdef)>>
<<if $damagetoenemy lt 0>>
<<set $damagetoenemy = 0>>
<</if>>
<<set $currentEnemy.NPCcurrenthealth -= $damagetoenemy>>
<<if $currentEnemy.NPCcurrenthealth lt 0>>
<<set $currentEnemy.NPCcurrenthealth = 0>>
<</if>>
<<set $temp_player_damage = $damagetoenemy>>
<<if $temp_player_damage lte 0>>
<<set $temp_player_damage = random(1,3)>>
Your strike bounces off the enemy's skin — it's as if you're punching a steel wall powered by spiritual essence.
You deal <<print $damagetoenemy.toFixed(2)>> damage!
<<else>>
You channel your Qi into your strike... It pierces the enemy's defense!
You strike your enemy, dealing <<print $damagetoenemy.toFixed(2)>> damage!
<</if>>
<</widget>>
<<widget "EnemyAttackAttempt">>
<<set _hitChance = 50 + ($currentEnemy.NPCagility - $agility)>>
<<set _hitChance = Math.max(10, Math.min(90, _hitChance))>>
<<set _roll = random(1,100)>>
<<if _roll <= _hitChance>>
<<set $enemyaction = "attack success">>
<<else>>
<<set $enemyaction = "attack failure">>
<br>─── ⚔️ ───<br>
<</if>>
<</widget>>
<<widget "EnemyAttackDamage">>
<<set $enemymindamage = Math.round($currentEnemy.NPCatk * 0.8)>>
<<set $enemymaxdamage = Math.round($currentEnemy.NPCatk * 1.2 + ($currentEnemy.NPCbasestrength / 3) + ($currentEnemy.NPCmartialArts / 4))>>
<<set $enemydamageroll = random($enemymindamage, $enemymaxdamage)>>
<<set $enemydamagerolltotal = $enemydamageroll + ($currentEnemy.NPCbasestrength / 2)>>
<<set $damagetoplayer = Math.round($enemydamagerolltotal - $def)>>
<<if $damagetoplayer lt 0>>
<<set $damagetoplayer = 0>>
<</if>>
<<set $health -= $damagetoplayer>>
<<if $health lt 0>>
<<set $health = 0>>
<</if>>
<<set $temp_enemy_damage = $damagetoplayer>>
<<if $temp_enemy_damage lte 0>>
<<set $temp_enemy_damage = random(1, 3)>>
Your defensive technique holds — you feel nothing.
<<else>>
The enemy strikes you fiercely, dealing <<print $damagetoplayer.toFixed(2)>> damage!
<<set _random to random(0,100)>>
<<if _random lte 10>>
Enemy attack torn a small part of your robes!
<<set $equippedRobe.durability -= random(5, 10)>>
<</if>>
<</if>>
<</widget>>
<<widget "EnemyBattleTable">>
<table class="xianxia-enemy-table">
<tr>
<th colspan="2" class="xianxia-name"><<print $currentEnemy.fullname>></th>
</tr>
<tr>
<td class="xianxia-label">Health:</td>
<td class="xianxia-value"><<print $currentEnemy.NPCcurrenthealth>> / <<print $currentEnemy.NPCmaxhealth>></td>
</tr>
<tr>
<td colspan="2" class="xianxia-health-icon">
<<if $currentEnemy.NPCcurrenthealth == $currentEnemy.NPCmaxhealth>>
<img src="images/Story/health10.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.9)>>
<img src="images/Story/health9.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.8)>>
<img src="images/Story/health8.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.7)>>
<img src="images/Story/health7.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.6)>>
<img src="images/Story/health6.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.5)>>
<img src="images/Story/health5.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.4)>>
<img src="images/Story/health4.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.3)>>
<img src="images/Story/health3.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.2)>>
<img src="images/Story/health2.png" width="200" />
<<elseif $currentEnemy.NPCcurrenthealth >= ($currentEnemy.NPCmaxhealth * 0.1)>>
<img src="images/Story/health1.png" width="200" />
<<else>>
<img src="images/Story/health0.png" width="200" />
<</if>>
</td>
</tr>
</table>
<</widget>>
<<widget "EnemyStun">>\
<<set $enemyaction = $currentEnemy.enemyAbility.random()>>
<<set $currentEnemy.enemyAbility.push($enemyaction)>>
<</widget>>
<<widget "AfterBattle">>
<<set $passiveatk to 0>>
<<set $passivedef to 0>>
<<set $passivecrit to 0>>
<<set $passivecritres to 0>>
<<set $passiveagility to 0>>
<<set $$battleRound to 0>>
<</widget>>/* Game Update Widget for 0.16*/
<<widget "GameUpdateWidget-016">>
<<set $cultivationRealms = ["Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm", "Foundation Establishment Realm", "Core Formation Realm", "Nascent Soul Realm"]>>
<<set $cultivationStages = ["Early", "Middle", "Late"]>>
<<set $GenerationNPCRealmStats = {
"Body Tempering Realm": {
"Early": {
"lifespan": [70, 80],
"health": [250, 320],
"energy": [180, 220],
"luck": [4, 6],
"insight": [4, 6],
"basestrength": [4, 6],
"basewillpower": [4, 6],
"atk": [35, 45],
"def": [4, 6],
"crit": [2, 4],
"critres": [1, 2],
"agility": [6, 8],
"martialArts": [8, 12],
"spiritualRoot": [9, 11]
},
"Middle": {
"lifespan": [85, 115],
"health": [350, 450],
"energy": [250, 320],
"luck": [6, 10],
"insight": [6, 10],
"basestrength": [7, 10],
"basewillpower": [6, 9],
"atk": [45, 85],
"def": [6, 10],
"crit": [4, 7],
"critres": [3, 5],
"agility": [8, 12],
"martialArts": [12, 18],
"spiritualRoot": [11, 14]
},
"Late": {
"lifespan": [115, 130],
"health": [500, 700],
"energy": [350, 500],
"luck": [8, 14],
"insight": [10, 16],
"basestrength": [11, 15],
"basewillpower": [10, 14],
"atk": [85, 120],
"def": [12, 18],
"crit": [6, 10],
"critres": [6, 10],
"agility": [12, 18],
"martialArts": [16, 25],
"spiritualRoot": [15, 20]
}
},
"Meridian Awakening Realm": {
"Early": {
"lifespan": [135, 140],
"health": [750, 900],
"energy": [600, 720],
"luck": [10, 14],
"insight": [12, 16],
"basestrength": [16, 20],
"basewillpower": [14, 18],
"atk": [120, 170],
"def": [20, 30],
"crit": [8, 12],
"critres": [8, 12],
"agility": [16, 22],
"martialArts": [24, 32],
"spiritualRoot": [22, 30]
},
"Middle": {
"lifespan": [145, 150],
"health": [1000, 1200],
"energy": [800, 1000],
"luck": [14, 20],
"insight": [18, 24],
"basestrength": [20, 26],
"basewillpower": [18, 24],
"atk": [170, 220],
"def": [28, 40],
"crit": [10, 16],
"critres": [10, 16],
"agility": [22, 30],
"martialArts": [30, 40],
"spiritualRoot": [28, 36]
},
"Late": {
"lifespan": [155, 160],
"health": [1400, 1800],
"energy": [1200, 1600],
"luck": [20, 28],
"insight": [26, 34],
"basestrength": [28, 36],
"basewillpower": [26, 32],
"atk": [220, 270],
"def": [40, 55],
"crit": [14, 20],
"critres": [14, 20],
"agility": [30, 40],
"martialArts": [38, 50],
"spiritualRoot": [35, 45]
}
},
"Qi Condensation Realm": {
"Early": {
"lifespan": [165, 170],
"health": [1900, 2300],
"energy": [1700, 2100],
"luck": [15, 20],
"insight": [20, 26],
"basestrength": [30, 38],
"basewillpower": [28, 35],
"atk": [300, 380],
"def": [45, 65],
"crit": [12, 18],
"critres": [12, 18],
"agility": [35, 45],
"martialArts": [45, 60],
"spiritualRoot": [40, 55]
},
"Middle": {
"lifespan": [175, 185],
"health": [2400, 2900],
"energy": [2200, 2700],
"luck": [20, 28],
"insight": [26, 34],
"basestrength": [38, 48],
"basewillpower": [35, 44],
"atk": [380, 480],
"def": [60, 85],
"crit": [16, 24],
"critres": [16, 24],
"agility": [45, 58],
"martialArts": [58, 75],
"spiritualRoot": [52, 70]
},
"Late": {
"lifespan": [190, 210],
"health": [3000, 3800],
"energy": [2800, 3500],
"luck": [26, 36],
"insight": [34, 44],
"basestrength": [48, 60],
"basewillpower": [44, 55],
"atk": [480, 580],
"def": [80, 110],
"crit": [22, 30],
"critres": [22, 30],
"agility": [55, 70],
"martialArts": [72, 90],
"spiritualRoot": [65, 85]
}
},
"Foundation Establishment Realm": {
"Early": {
"lifespan": [220, 250],
"health": [4200, 5200],
"energy": [3800, 4600],
"luck": [28, 38],
"insight": [38, 50],
"basestrength": [55, 70],
"basewillpower": [50, 65],
"atk": [620, 750],
"def": [100, 135],
"crit": [25, 35],
"critres": [25, 35],
"agility": [65, 82],
"martialArts": [85, 110],
"spiritualRoot": [80, 105]
},
"Middle": {
"lifespan": [255, 290],
"health": [5400, 6800],
"energy": [4800, 5900],
"luck": [35, 48],
"insight": [48, 62],
"basestrength": [68, 85],
"basewillpower": [62, 78],
"atk": [760, 920],
"def": [130, 170],
"crit": [32, 45],
"critres": [32, 45],
"agility": [80, 100],
"martialArts": [105, 135],
"spiritualRoot": [100, 130]
},
"Late": {
"lifespan": [300, 350],
"health": [7000, 8800],
"energy": [6100, 7600],
"luck": [45, 60],
"insight": [60, 78],
"basestrength": [85, 105],
"basewillpower": [78, 95],
"atk": [930, 1120],
"def": [165, 215],
"crit": [40, 55],
"critres": [40, 55],
"agility": [98, 122],
"martialArts": [130, 165],
"spiritualRoot": [125, 160]
}
},
"Core Formation Realm": {
"Early": {
"lifespan": [380, 450],
"health": [9500, 12000],
"energy": [8500, 10500],
"luck": [50, 68],
"insight": [70, 90],
"basestrength": [110, 140],
"basewillpower": [100, 125],
"atk": [1250, 1550],
"def": [220, 290],
"crit": [48, 65],
"critres": [48, 65],
"agility": [120, 150],
"martialArts": [170, 215],
"spiritualRoot": [155, 200]
},
"Middle": {
"lifespan": [460, 550],
"health": [12500, 15800],
"energy": [11000, 13800],
"luck": [65, 85],
"insight": [88, 112],
"basestrength": [135, 170],
"basewillpower": [125, 155],
"atk": [1580, 1950],
"def": [280, 370],
"crit": [60, 80],
"critres": [60, 80],
"agility": [150, 185],
"martialArts": [210, 265],
"spiritualRoot": [195, 245]
},
"Late": {
"lifespan": [560, 700],
"health": [16500, 21000],
"energy": [14500, 18000],
"luck": [80, 105],
"insight": [110, 140],
"basestrength": [165, 210],
"basewillpower": [155, 190],
"atk": [1980, 2450],
"def": [360, 470],
"crit": [75, 100],
"critres": [75, 100],
"agility": [185, 230],
"martialArts": [260, 330],
"spiritualRoot": [240, 300]
}
},
"Nascent Soul Realm": {
"Early": {
"lifespan": [800, 1200],
"health": [24000, 31000],
"energy": [21000, 27000],
"luck": [95, 125],
"insight": [130, 170],
"basestrength": [220, 280],
"basewillpower": [200, 255],
"atk": [2700, 3400],
"def": [480, 620],
"crit": [90, 120],
"critres": [90, 120],
"agility": [240, 300],
"martialArts": [340, 430],
"spiritualRoot": [290, 370]
},
"Middle": {
"lifespan": [1300, 1800],
"health": [32000, 42000],
"energy": [28000, 36000],
"luck": [120, 160],
"insight": [165, 215],
"basestrength": [275, 350],
"basewillpower": [255, 320],
"atk": [3500, 4400],
"def": [610, 790],
"crit": [115, 150],
"critres": [115, 150],
"agility": [300, 375],
"martialArts": [430, 540],
"spiritualRoot": [360, 460]
},
"Late": {
"lifespan": [2000, 3000],
"health": [45000, 60000],
"energy": [39000, 52000],
"luck": [155, 210],
"insight": [210, 270],
"basestrength": [350, 440],
"basewillpower": [320, 400],
"atk": [4600, 5800],
"def": [780, 1000],
"crit": [145, 190],
"critres": [145, 190],
"agility": [380, 480],
"martialArts": [550, 700],
"spiritualRoot": [450, 580]
}
}
}>>
<<set $gameVersion = 0.16>>
<</widget>><<widget "updateDestinyStats">>
<<set $destinyatk = 0>>
<<set $destinydef = 0>>
<<set $destinycrit = 0>>
<<set $destinycritres = 0>>
<<set $destinyagility = 0>>
<<set $destinymartialArts = 0>>
<<set $destinyspiritualRoot = 0>>
<<set $righteousreputation = 0>>
<<set $demonicreputation = 0>>
<<set $destinylifespan = 0>>
<<set $destinyenergy = 0>>
<<set $destinyhealth = 0>>
<<for _d range $playerDestiny>>
<<if _d.destinyatk>> <<set $destinyatk += _d.destinyatk>> <</if>>
<<if _d.destinydef>> <<set $destinydef += _d.destinydef>> <</if>>
<<if _d.destinycrit>> <<set $destinycrit += _d.destinycrit>> <</if>>
<<if _d.destinycritres>> <<set $destinycritres += _d.destinycritres>> <</if>>
<<if _d.destinyagility>> <<set $destinyagility += _d.destinyagility>> <</if>>
<<if _d.destinymartialArts>> <<set $destinymartialArts += _d.destinymartialArts>> <</if>>
<<if _d.destinyspiritualRoot>> <<set $destinyspiritualRoot += _d.destinyspiritualRoot>> <</if>>
<<if _d.righteousreputation>> <<set $righteousreputation += _d.righteousreputation>> <</if>>
<<if _d.demonicreputation>> <<set $demonicreputation += _d.demonicreputation>> <</if>>
<<if _d.destinylifespan>> <<set $destinylifespan += _d.destinylifespan>> <</if>>
<<if _d.destinyenergy>> <<set $destinyenergy += _d.destinyenergy>> <</if>>
<<if _d.destinyhealth>> <<set $destinyhealth += _d.destinyhealth>> <</if>>
<</for>>
<<set $atk = $baseatk + $destinyatk>>
<<set $def = $basedef + $destinydef>>
<<set $crit = $basecrit + $destinycrit>>
<<set $critres = $basecritres + $destinycritres>>
<<set $agility = $baseagility + $destinyagility>>
<<set $martialArts = $basemartialArts + $destinymartialArts>>
<<set $spiritualRoot = $basespiritualRoot + $destinyspiritualRoot>>
<<set $maxlifespan to $basemaxlifespan + $destinylifespan>>
<<set $maxhealth to $basemaxhealth + $destinyenergy>>
<<set $maxenergy to $basemaxenergy + $destinyhealth>>
<<set $health = $maxhealth>>
<<set $energy = $maxenergy>>
<</widget>>
/* === UNIQUE CONSTITUTION GENERATION (xianxia style, every combo = different name) === */
<<widget "ConstitutionCalc">>
<<if $playerDestiny.length !== 3>>
<<set $constitutionName to "Incomplete Fate">>
<<set $constitutionDesc to "The Heavenly Dao cannot form your body. Exactly three destinies must converge before a true constitution can awaken.">>
<<else>>
/* Gather essences */
<<set _essences to []>>
<<for _d range $playerDestiny>>
<<set _essences.push(_d.essence)>>
<</for>>
/* Sort for stable keys */
<<set _sorted to _essences.sort()>>
<<set _key to _sorted.join("-")>>
/* ================================= */
/* LEGENDARY 3-DESTINY PHYSIQUES */
/* ================================= */
<<if _key === "Demonic-Demonic-Mind">>
<<set $constitutionName to "Abyssal Soul Devouring Physique">>
<<elseif _key === "Heaven-Heaven-Spirit">>
<<set $constitutionName to "Saintly Celestial Spirit Body">>
<<elseif _key === "Beast-Earth-Martial">>
<<set $constitutionName to "Primordial Titan War Body">>
<<elseif _key === "Fire-Heaven-Spirit">>
<<set $constitutionName to "Vermilion Phoenix Immortal Body">>
/* ================================= */
/* ELEMENTAL BODIES */
/* ================================= */
<<elseif _essences.includes("Fire") and _essences.includes("Ice")>>
<<set $constitutionName to "Primordial Yin-Yang Body">>
<<elseif _essences.includes("Fire")>>
<<set $constitutionName to "Blazing Vermilion Flame Physique">>
<<elseif _essences.includes("Ice")>>
<<set $constitutionName to "Frozen Jade Spirit Body">>
/* ================================= */
/* DEMONIC PATH */
/* ================================= */
<<elseif _essences.includes("Demonic")>>
<<set $constitutionName to "Nether Demon Devouring Body">>
/* ================================= */
/* HEAVENLY PATH */
/* ================================= */
<<elseif _essences.includes("Heaven")>>
<<set $constitutionName to "Heavenly Dao Blessed Physique">>
/* ================================= */
/* MARTIAL PATH */
/* ================================= */
<<elseif _essences.includes("Martial")>>
<<set $constitutionName to "Asura Martial War Body">>
/* ================================= */
/* BEAST PATH */
/* ================================= */
<<elseif _essences.includes("Beast")>>
<<set $constitutionName to "Ancient Beast Blood Physique">>
/* ================================= */
/* EARTH / BODY PATH */
/* ================================= */
<<elseif _essences.includes("Earth") or _essences.includes("Body")>>
<<set $constitutionName to "Titan Stone Physique">>
/* ================================= */
/* SPIRIT PATH */
/* ================================= */
<<elseif _essences.includes("Spirit")>>
<<set $constitutionName to "Celestial Spirit Vessel">>
/* ================================= */
/* FALLBACK */
/* ================================= */
<<else>>
<<set $constitutionName to "Myriad Dao Cultivation Body">>
<</if>>
/* ================================= */
/* PREFIX SYSTEM */
/* ================================= */
<<set _prefix to "">>
<<if $destinyspiritualRoot gte 15>>
<<set _prefix to "Heaven-Blessed ">>
<<elseif $demonicreputation gte 15>>
<<set _prefix to "Forbidden ">>
<<elseif $righteousreputation gte 15>>
<<set _prefix to "Saintly ">>
<</if>>
<<set $constitutionName to _prefix + $constitutionName>>
/* ================================= */
/* DESCRIPTION */
/* ================================= */
<<set $constitutionDesc to "Your meridians collapse and reform as the Heavenly Dao reshapes your body. The convergence of three destinies forges the " + $constitutionName >>
<</if>>
<</widget>>
<<widget "cultivationStatus">>
$cultivationStage $cultivationRealm
<</widget>>
<<widget "EnergyRecovery">>
<<if passage() is "Map|Region1">>
<<if $turns > $lastRecoveryTurn>>
<<set _EnergyRecovered = Math.round($maxenergy * $energyRecovery)>>
<<set $energy += _EnergyRecovered>>
<<if $energy > $maxenergy>><<set $energy = $maxenergy>><</if>>
<</if>>
<</if>>
<</widget>>
<<widget "HealthRecovery">>
<<if passage() is "Map|Region1">>
<<if $turns > $lastRecoveryTurn>>
<<set _HealthRecovered = Math.round($maxhealth * $healthRecovery)>>
<<set $health += _HealthRecovered>>
<<if $health > $maxhealth>><<set $health = $maxhealth>><</if>>
<</if>>
<</if>>
<</widget>>
<<widget "StatsRecovery">>
<<EnergyRecovery>>
<<HealthRecovery>>
<<set $lastRecoveryTurn = $turns>>
<</widget>>
<<widget "TurnsAge">>
/* Use State.variables to ensure we are looking at the exact same data the JS is touching */
<<if $turns gte $turnsPerYear>>
<<set $lifespan += 1>>
<<set $turns = 0>>
<div class="age-announcement">A year has passed. You are now $lifespan years old.</div>
<<if $known_npc_list and $known_npc_list.length gt 0>>
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<set _loopNPC to $known_npc_list[_i]>>
<<if !_loopNPC.isDead>>
/* Increment their current age */
<<set _loopNPC.NPClifespan += 1>>
/* Check against their max */
<<if _loopNPC.NPClifespan gt _loopNPC.NPCmaxlifespan>>
<<set _loopNPC.isDead to true>>
<<set _loopNPC.deathCause = "old_age">>
<<set _loopNPC.killedByPlayer = false>>
<<set _loopNPC.killedInRevenge = false>>
<<set _loopNPC.deathGrudgeType = null>>
<<set _loopNPC.deathGrudgeVictim = null>>
<</if>>
<</if>>
<</for>>
<</if>>
<</if>>
<</widget>>
<<widget "MapRender">>
<<set $passage to passage()>>
<<set _tileSize = 50>>
<<set _x = $playerX * _tileSize>>
<<set _y = $playerY * _tileSize>>
<<if _x == 0>><<set _x = 1>><</if>>
<<if _y == 0>><<set _y = 1>><</if>>
<<if $activeSideMission neq null>>
<<set _sideMX = $activeSideMission.missionCordX * _tileSize>>
<<set _sideMY = $activeSideMission.missionCordY * _tileSize>>
<</if>>
<div id="map-container">
<<print '<div class="player-icon" style="left: ' + _x + 'px; top: ' + _y + 'px;"></div>'>>
<<if $SideMissionStatus is "accepted">>
<<print '<div class="sidemission-icon" style="left: ' + _sideMX + 'px; top: ' + _sideMY + 'px;"></div>'>>
<</if>>
</div>
<</widget>>
<<widget "MissionNotification">>
<<if _x eq _sideMX and _y eq _sideMY>>\
<span class="mission">You're on your mission location!</span>
<<link "Go!" "Mission|Region1">>
<</link>>
<</if>>
<</widget>>
<<widget "Movement">>
<<TurnsAge>>
<div id="movement-controls">
<<if $playerY > 2>>
<<link "↑ North">>
<<set $playerY -= 1>>
<<set $turns += 1>>
<<run localStorage.setItem("playerX", $playerX)>>
<<run localStorage.setItem("playerY", $playerY)>>
<<run localStorage.setItem("turns", $turns)>>
<<replace "#movement-controls">><<Movement>><</replace>>
<<replace "#map-container">><<MapRender>><</replace>>
<<replace "#event-container">><<RegionEvents>><<NpcPosition>><<MortalRealm>><<TurnsAge>><<MissionNotification>><</replace>>
<</link>>
<</if>>
<<if $playerY < 13>>
<<link "↓ South">>
<<set $playerY += 1>>
<<set $turns += 1>>
<<run localStorage.setItem("playerX", $playerX)>>
<<run localStorage.setItem("playerY", $playerY)>><<run localStorage.setItem("turns", $turns)>>
<<replace "#movement-controls">><<Movement>><</replace>>
<<replace "#map-container">><<MapRender>><</replace>>
<<replace "#event-container">><<RegionEvents>><<NpcPosition>><<MortalRealm>><<TurnsAge>><<MissionNotification>><</replace>>
<</link>>
<</if>>
<<if $playerX > 0>>
<<link "← West">>
<<set $playerX -= 1>>
<<set $turns += 1>>
<<run localStorage.setItem("playerX", $playerX)>>
<<run localStorage.setItem("playerY", $playerY)>><<run localStorage.setItem("turns", $turns)>>
<<replace "#movement-controls">><<Movement>><</replace>>
<<replace "#map-container">><<MapRender>><</replace>>
<<replace "#event-container">><<RegionEvents>><<NpcPosition>><<MortalRealm>><<TurnsAge>><<MissionNotification>><</replace>>
<</link>>
<</if>>
<<if $playerX < 11>>
<<link "→ East">>
<<set $playerX += 1>>
<<set $turns += 1>>
<<run localStorage.setItem("playerX", $playerX)>>
<<run localStorage.setItem("playerY", $playerY)>><<run localStorage.setItem("turns", $turns)>>
<<replace "#movement-controls">><<Movement>><</replace>>
<<replace "#map-container">><<MapRender>><</replace>>
<<replace "#event-container">><<RegionEvents>><<NpcPosition>><<MortalRealm>><<TurnsAge>><<MissionNotification>><</replace>>
<</link>>
<</if>>
</div>
<</widget>>
<<widget "refreshMissions">>
<<include "SideMissions">>
<<if $sidemissions>>
<<set $visibleMissions to []>>
<<set _pool to $sidemissions.filter(m => m.region === $currentRegion)>>
<<set _shuffled to _pool.sort(() => 0.5 - Math.random())>>
<<for _i to 0; _i < 5 && _i < _shuffled.length; _i++>>
<<set $visibleMissions.push(_shuffled[_i])>>
<<set $activeSideMission to null>>
<<set $SideMissionStatus to null>>
<</for>>
<<elseif $SectSideMissions>>
<<set $visibleMissions to []>>
<<set _pool to $SectSideMissions.filter(m => m.region === $currentRegion)>>
<<set _shuffled to _pool.sort(() => 0.5 - Math.random())>>
<<for _i to 0; _i < 5 && _i < _shuffled.length; _i++>>
<<set $visibleMissions.push(_shuffled[_i])>>
<<set $activeSideMission to null>>
<<set $SideMissionStatus to null>>
<</for>>
<</if>>
<</widget>>
<<widget "statusCondition">>
<<showmeter "health">>
<<updatemeter "health" `$health / $maxhealth`>>
<<showmeter "energy">>
<<updatemeter "energy" `$energy / $maxenergy`>>
<div class="status">
<!-- HEALTH STATUS -->
<<if $health <= 0.1 * $maxhealth>>
<p><span class="wounded">⚠ You are on the brink of death!</span></p>
<<elseif $health <= 0.25 * $maxhealth>>
<p><span class="wounded">You are gravely wounded.</span></p>
<<elseif $health <= 0.5 * $maxhealth>>
<p><span class="wounded">You're bleeding and in pain.</span></p>
<<elseif $health <= 0.75 * $maxhealth>>
<p><span class="wounded">You're slightly injured.</span></p>
<<else>>
<p><span class="healthy">You're in good health.</span></p>
<</if>>
<!-- ENERGY (QI) STATUS -->
<<if $energy <= 0.1 * $maxenergy>>
<p><span class="drained">⚠ Your qi is nearly depleted!</span></p>
<<elseif $energy <= 0.25 * $maxenergy>>
<p><span class="drained">Your inner energy is dangerously low.</span></p>
<<elseif $energy <= 0.5 * $maxenergy>>
<p><span class="drained">Your qi circulation is weak.</span></p>
<<elseif $energy <= 0.75 * $maxenergy>>
<p><span class="drained">You feel a drain on your energy.</span></p>
<<else>>
<p><span class="focused">Your qi flows steadily.</span></p>
<</if>>
</div>
<</widget>>
<<widget "Breakthrough">>
<<set _realms = ["Mortal","Body Tempering Realm", "Meridian Awakening Realm", "Qi Condensation Realm", "Foundation Establishment Realm", "Core Formation Realm", "Nascent Soul Realm"]>>
<<set _stages = ["Early", "Middle", "Late"]>>
<<set _realmIndex = _realms.indexOf($cultivationRealm)>>
<<set _stageIndex = _stages.indexOf($cultivationStage)>>
<<set _baseExp = 1000>>
<<set _requiredExp = _baseExp * Math.pow(_realmIndex + 1, 2) * (_stageIndex + 1)>>
<<set _progress = Math.min(100, Math.round(($exp / _requiredExp) * 100))>>
<div style="border: 1px solid #777; padding: 1em; width: 90%; background: rgba(255,255,255,0.05); border-radius: 10px; font-family: 'serif'; color: #e0e0e0;">
<h3 style="margin: 0 0 0.5em 0; color: #8ff;">🧘 Cultivation Status</h3>
<p><strong>Stage:</strong> $cultivationStage<br>
<strong>Realm:</strong> $cultivationRealm</p>
<p><strong>EXP:</strong> $exp / <<print _requiredExp>> (<<print _progress>>%)</p>
<div style="width: 100%; height: 20px; background: #333; border: 1px solid #666; border-radius: 5px; margin-bottom: 1em;">
<div style="width: <<print _progress>>%; height: 100%; background: linear-gradient(to right, #00f2ff, #4dffbf); border-radius: 5px;"></div>
</div>
<!-- Breakthrough Button -->
<<if $exp >= _requiredExp>>
<<link "🌌 Attempt Breakthrough" "Breakthrough1">><<set $exp to $exp - _requiredExp>> <</link>>
<<else>>
<p style="color:#ff6b6b; font-weight:bold; margin-top:20px;">
Not enough EXP to attempt breakthrough yet.
</p>
<</if>>
<</widget>>
<<widget "UpdatePlayerStats">>
<<set _multiplier to $args[0]>>
<<set $basemaxlifespan = Math.round($basemaxlifespan * _multiplier)>>
<<set $basemaxhealth = Math.round($basemaxhealth * _multiplier)>>
<<set $basemaxenergy = Math.round($basemaxenergy * _multiplier)>>
<<set $baseluck = Math.round($baseluck * _multiplier)>>
<<set $baseinsight = Math.round($baseinsight * _multiplier)>>
<<set $basebasestrength = Math.round($basebasestrength * _multiplier)>>
<<set $basebasewillpower = Math.round($basebasewillpower * _multiplier)>>
<<set $baseatk = Math.round($baseatk * _multiplier)>>
<<set $basedef = Math.round($basedef * _multiplier)>>
<<set $baseagility = Math.round($baseagility * _multiplier)>>
<<set $basemartialArts = Math.round($basemartialArts * _multiplier)>>
<<set $basespiritualRoot = Math.round($basespiritualRoot * _multiplier)>>
<</widget>>
<<widget "BreakthroughEvent">>
<<set _breakthroughOutcome = random(1, 100)>>
<<set _cancel = 0>>
<div class="outcome-box">
<<if _breakthroughOutcome lte 12>>
<!-- Qi Deviation - slightly rarer -->
<img src="images/Story/qideviation.png" width="60%" style="border-radius:12px; box-shadow:0 0 20px #ff6b6b;">
<p class="outcome-failure"><b>Qi Deviation!</b><br>Your meridians rebel in chaos. Blood sprays from your mouth as heavenly punishment strikes.</p>
<<set $health = Math.floor($health * 0.45)>>
<<set $energy = Math.floor($energy * 0.45)>>
<p>Your life hangs by a thread. <span class="red">Recover and try again.</span></p>
<<set _cancel = 1>>
<<LogEvent "cultivation" "Qi Deviation" "Your breakthrough attempt failed spectacularly. Your health and energy are heavily damaged." 2>>
<<elseif _breakthroughOutcome gt 12 and _breakthroughOutcome lte 78>>
<!-- Normal Breakthrough -->
<img src="images/Story/normal.png" width="60%" style="border-radius:12px; box-shadow:0 0 20px #66bb6a;">
<p class="outcome-success"><b>Breakthrough Successful!</b><br>Your qi surges forward like a calm river breaking a dam.</p>
<<set _multiplier = 1.28 + Math.random() * 0.12>> /* 1.28x ~ 1.40x */
<<else>>
<!-- Enlightenment - better rewards -->
<img src="images/Story/enlightenment.png" width="60%" style="border-radius:12px; box-shadow:0 0 20px gold;">
<p class="outcome-enlightenment"><b>Enlightenment Descends!</b><br>The Dao opens its eyes upon you. Power floods your body!</p>
<<set _multiplier = 1.45 + Math.random() * 0.15>> /* 1.45x ~ 1.60x */
<</if>>
<<if _cancel eq 1>>
<<link "Forfeit Attempt" "Breakthrough">>
<<set $exp -= random(150, 800)>>
<</link>>
<<else>>
<<set _realmIndex = $cultivationRealms.indexOf($cultivationRealm)>>
<<set _stageIndex = $cultivationStages.indexOf($cultivationStage)>>
<<run _stageIndex++>>
<<if _stageIndex gte $cultivationStages.length>>
<<set _stageIndex = 0>>
<<set _realmIndex++>>
<<if _realmIndex gte $cultivationRealms.length>>
<p class="outcome-enlightenment">You have reached the peak of known cultivation!</p>
<<LogEvent "cultivation" "Peak of Cultivation" "You have reached the absolute peak of known cultivation." 5>>
<<else>>
<<set $cultivationRealm = $cultivationRealms[_realmIndex]>>
<<set $cultivationStage = $cultivationStages[_stageIndex]>>
<p class="outcome-success">New Realm Achieved!<br><b>$cultivationRealm</b> ($cultivationStage)</p>
<</if>>
<<else>>
<<set $cultivationStage = $cultivationStages[_stageIndex]>>
<p class="outcome-success">New Stage Achieved!<br><b>$cultivationStage</b> $cultivationRealm</p>
<</if>>
<<if _cancel eq 0>>
<<link "Return" "Breakthrough">>
<!-- === MAIN STAT UPDATE - This is the key improvement === -->
<<UpdatePlayerStats _multiplier>>
<!-- Constitution bonus on breakthrough (very important for not falling behind) -->
<<if $constitutionName && $constitutionName.includes("Vermilion") || $constitutionName.includes("Blazing") || $constitutionName.includes("Flame")>>
<<set _constBonus = 1.12>> /* 12% extra for your flame physique */
<<elseif $constitutionName && $constitutionName.includes("Saintly") || $constitutionName.includes("Heaven")>>
<<set _constBonus = 1.10>>
<<else>>
<<set _constBonus = 1.06>>
<</if>>
<<set _finalMultiplier = _multiplier * _constBonus>>
/* Optional: extra boost when entering new realm */
<<if _stageIndex eq 0>>
<<set _finalMultiplier = _finalMultiplier * 1.18>>
<</if>>
<<set $playerPower = $power[$cultivationRealm][$cultivationStage] || 0>>
<<set _desc = "Breakthrough to " + $cultivationStage + " " + $cultivationRealm + ". Power surges dramatically.">>
<<LogEvent "breakthrough" "Advancement" _desc 4>>
<</link>>
<</if>>
<</if>>
</div>
<</widget>>
<<widget "HealthBar">>
<<if $currenthealth eq $maxhealth>><img src="Images/Icons/health10.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.9)>><img src="Images/Icons/health9.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.8)>><img src="Images/Icons/health8.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.7)>><img src="Images/Icons/health7.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.6)>><img src="Images/Icons/health6.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.5)>><img src="Images/Icons/health5.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.4)>><img src="Images/Icons/health4.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.3)>><img src="Images/Icons/health3.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.2)>><img src="Images/Icons/health2.png" width=200 /><<elseif $currenthealth gte ($maxhealth*0.1)>><img src="Images/Icons/health1.png" width=200 /><<else>><img src="Images/Icons/health0.png" width=200 /><</if>>
<</widget>>
<<widget "HeaderFooter">>
<<if $energy gt $maxenergy>> <<set $energy = $maxenergy>><</if>>
<<if $energy lt 0>> <<set $energy = 0>><</if>>
<<if $health gt $maxhealth>> <<set $health = $maxhealth>><</if>>
<</widget>>
<<widget "FameUpdater">>
<<set $totalPCrighteousreputation to $PCrighteousreputation + $righteousreputation>>
<<set $totalPCdemonicreputation to $PCdemonicreputation + $demonicreputation>>
<<set $totalFame to ($fame + $sectFame + $cultivationFame + $combatFame)>>
<</widget>>
<<widget "StatsUpdater">>
/* Base stats + destiny bonuses */
<<set $atk = $baseatk + $destinyatk + ($basestrength*0.5) + $passiveatk>>
<<set $def = $basedef + $destinydef + $passivedef>>
<<set $crit = $basecrit + $destinycrit + $passivecrit>>
<<set $critres = $basecritres + $destinycritres + $passivecritres>>
<<set $agility = $baseagility + $destinyagility + $passiveagility>>
<<set $martialArts = $basemartialArts + $destinymartialArts>>
<<set $spiritualRoot = $basespiritualRoot + $destinyspiritualRoot>>
/* Core stats */
<<set $luck to $baseluck>>
<<set $insight to $baseinsight>>
<<set $evadescore = ($agility * 2) + ($insight * 1.5) + ($luck * 0.5)>>
/* Max stats */
<<set $maxlifespan to $basemaxlifespan + $destinylifespan>>
<<set $maxhealth to $basemaxhealth + $destinyenergy>>
<<set $maxenergy to $basemaxenergy + $destinyhealth>>
/* ==================== EQUIPMENT BONUSES ==================== */
/* Reset equipment bonuses */
<<set $equipatk to 0>>
<<set $equipdef to 0>>
<<set $equipcrit to 0>>
<<set $equipcritres to 0>>
<<set $equipagility to 0>>
<<set $equipwillpower to 0>>
<<set $equipstrength to 0>>
<<set $equiparmor to 0>>
<<set $equipinsight to 0>>
/* Robe Bonuses */
<<if $equippedRobe neq null>>
<<if $equippedRobe.stats neq null>>
<<if $equippedRobe.stats.atk neq null>><<set $equipatk += $equippedRobe.stats.atk>><</if>>
<<if $equippedRobe.stats.def neq null>><<set $equipdef += $equippedRobe.stats.def>><</if>>
<<if $equippedRobe.stats.crit neq null>><<set $equipcrit += $equippedRobe.stats.crit>><</if>>
<<if $equippedRobe.stats.critres neq null>><<set $equipcritres += $equippedRobe.stats.critres>><</if>>
<<if $equippedRobe.stats.agility neq null>><<set $equipagility += $equippedRobe.stats.agility>><</if>>
<<if $equippedRobe.stats.willpower neq null>><<set $equipwillpower += $equippedRobe.stats.willpower>><</if>>
<<if $equippedRobe.stats.strength neq null>><<set $equipstrength += $equippedRobe.stats.strength>><</if>>
<<if $equippedRobe.stats.armor neq null>><<set $equiparmor += $equippedRobe.stats.armor>><</if>>
<<if $equippedRobe.stats.insight neq null>><<set $equipinsight += $equippedRobe.stats.insight>><</if>>
<</if>>
<</if>>
/* Underwear Bonuses */
<<if $equippedUnderwear neq null>>
<<if $equippedUnderwear.stats neq null>>
<<if $equippedUnderwear.stats.atk neq null>><<set $equipatk += $equippedUnderwear.stats.atk>><</if>>
<<if $equippedUnderwear.stats.def neq null>><<set $equipdef += $equippedUnderwear.stats.def>><</if>>
<<if $equippedUnderwear.stats.crit neq null>><<set $equipcrit += $equippedUnderwear.stats.crit>><</if>>
<<if $equippedUnderwear.stats.critres neq null>><<set $equipcritres += $equippedUnderwear.stats.critres>><</if>>
<<if $equippedUnderwear.stats.agility neq null>><<set $equipagility += $equippedUnderwear.stats.agility>><</if>>
<<if $equippedUnderwear.stats.willpower neq null>><<set $equipwillpower += $equippedUnderwear.stats.willpower>><</if>>
<<if $equippedUnderwear.stats.strength neq null>><<set $equipstrength += $equippedUnderwear.stats.strength>><</if>>
<<if $equippedUnderwear.stats.armor neq null>><<set $equiparmor += $equippedUnderwear.stats.armor>><</if>>
<<if $equippedUnderwear.stats.insight neq null>><<set $equipinsight += $equippedUnderwear.stats.insight>><</if>>
<</if>>
<</if>>
/* Weapon Bonuses */
<<if $equippedWeapon neq null>>
<<if $equippedWeapon.stats neq null>>
<<if $equippedWeapon.stats.atk neq null>><<set $equipatk += $equippedWeapon.stats.atk>><</if>>
<<if $equippedWeapon.stats.def neq null>><<set $equipdef += $equippedWeapon.stats.def>><</if>>
<<if $equippedWeapon.stats.crit neq null>><<set $equipcrit += $equippedWeapon.stats.crit>><</if>>
<<if $equippedWeapon.stats.critres neq null>><<set $equipcritres += $equippedWeapon.stats.critres>><</if>>
<<if $equippedWeapon.stats.agility neq null>><<set $equipagility += $equippedWeapon.stats.agility>><</if>>
<<if $equippedWeapon.stats.willpower neq null>><<set $equipwillpower += $equippedWeapon.stats.willpower>><</if>>
<<if $equippedWeapon.stats.strength neq null>><<set $equipstrength += $equippedWeapon.stats.strength>><</if>>
<<if $equippedWeapon.stats.armor neq null>><<set $equiparmor += $equippedWeapon.stats.armor>><</if>>
<<if $equippedWeapon.stats.insight neq null>><<set $equipinsight += $equippedWeapon.stats.insight>><</if>>
<</if>>
<</if>>
/* Accessories Bonuses (3 slots) */
<<if $equippedAccessories neq null>>
<<for _i to 0; _i lt 3; _i++>>
<<set _acc to $equippedAccessories[_i]>>
<<if _acc neq null>>
<<if _acc.stats neq null>>
<<if _acc.stats.atk neq null>><<set $equipatk += _acc.stats.atk>><</if>>
<<if _acc.stats.def neq null>><<set $equipdef += _acc.stats.def>><</if>>
<<if _acc.stats.crit neq null>><<set $equipcrit += _acc.stats.crit>><</if>>
<<if _acc.stats.critres neq null>><<set $equipcritres += _acc.stats.critres>><</if>>
<<if _acc.stats.agility neq null>><<set $equipagility += _acc.stats.agility>><</if>>
<<if _acc.stats.willpower neq null>><<set $equipwillpower += _acc.stats.willpower>><</if>>
<<if _acc.stats.strength neq null>><<set $equipstrength += _acc.stats.strength>><</if>>
<<if _acc.stats.armor neq null>><<set $equiparmor += _acc.stats.armor>><</if>>
<<if _acc.stats.insight neq null>><<set $equipinsight += _acc.stats.insight>><</if>>
<</if>>
<</if>>
<</for>>
<</if>>
/* ==================== FINAL STATS WITH EQUIPMENT ==================== */
<<set $atk += $equipatk>>
<<set $def += $equipdef>>
<<set $crit += $equipcrit>>
<<set $critres += $equipcritres>>
<<set $agility += $equipagility>>
<<set $willpower = $basewillpower + $equipwillpower>> /* Add willpower if you have $willpower stat */
<<set $strength = $basestrength + $equipstrength>> /* Add strength if needed */
<<set $armor = $equiparmor>> /* New armor stat if you use it */
<<set $insight += $equipinsight>>
/* Recalculate evade if affected */
<<set $evadescore = ($agility * 2) + ($insight * 1.5) + ($luck * 0.5)>>
<</widget>>
<<widget "MissionFinish">>
<<if $MissionType eq "sect">>
<<set $ContributionPoints to ($ContributionPoints += $activeSideMission.reward)>>
<<set $CurrentPcSectReputation to ($CurrentPcSectReputation += $activeSideMission.gainFame)>>
<<set $sectFavor to ($sectFavor += $activeSideMission.favor)>>
<span class="mission"> <i>Mission finished!</i> </span>
<<link "Go back" $passage>><<set $pe to 0>><<set $activeSideMission to null>><<set $SideMissionStatus to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>><</link>>
<<else>>
<span class="mission"> <i>Mission finished!</i> </span>
<<set $gold to ($gold += $activeSideMission.reward)>>
<<set $fame to ($fame += $activeSideMission.gainFame)>>
<<link "Go back" $passage>><<set $pe to 0>><<set $SideMissionStatus to null>><<set $activeSideMission to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>><</link>>
<</if>>
<</widget>>
<<widget "MissionFinishAuto">>
<<if $MissionType eq "sect">>
<<set $ContributionPoints to ($ContributionPoints += $activeSideMission.reward)>>
<<set $CurrentPcSectReputation to ($CurrentPcSectReputation += $activeSideMission.gainFame)>>
<<set $sectFavor to ($sectFavor += $activeSideMission.favor)>>
<span class="mission"> <i>Mission finished!</i> </span>
<<set $pe to 0>><<set $activeSideMission to null>><<set $SideMissionStatus to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>>
<<else>>
<span class="mission"> <i>Mission finished!</i> </span>
<<set $gold to ($gold += $activeSideMission.reward)>>
<<set $fame to ($fame += $activeSideMission.gainFame)>>
<<set $pe to 0>><<set $SideMissionStatus to null>><<set $activeSideMission to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>>
<</if>>
<</widget>>
<<widget "MissionFailed">>
<<if $MissionType eq "sect">>
<span class="mission"> <i>Mission failed!</i> </span>
<<link "Go back" $passage>><<set $pe to 0>><<set $activeSideMission to null>><<set $SideMissionStatus to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>><</link>>
<<else>>
<span class="mission"> <i>Mission failed!</i> </span>
<<link "Go back" $passage>><<set $pe to 0>><<set $SideMissionStatus to null>><<set $activeSideMission to null>><<set $turns += 1>><<set $npcFinished to null>><<set $cumcount = 0>><</link>>
<</if>>
<</widget>>
<<widget "PositionCheckSex">>
<<if $cumcount >= 3>>
<<set _roll = random(1, 100)>>
<<if _roll <= 25>>
<<set $npcFinished = true>>
<p>He suddenly groans and releases deep inside without warning!</p>
<</if>>
<<if not $npcFinished>>
<p>He's close. Where do you want him to finish?</p>
<<link "Inside">>
<p>You pull him deeper and feel him release inside you.</p>
<</link>>
<<link "Outside">>
<p>You pull back just in time — he spills over your stomach.</p>
<</link>>
<<link "On your back">>
<p>You drop to your knees, and he finishes across your back.</p>
<</link>>
<</if>>
<</if>>
<</widget>>
<!-- Portrait updater -->
<<widget "UpdatePortrait">>
<div class="portrait-container">
<<if $equippedRobe.name neq "Naked State" and $equippedRobe.durability neq null>>
<<set _dur to $equippedRobe.durability>>
<<set _maxDur to $equippedRobe.maxDurability>>
<<if _dur eq _maxDur>>
<img src="images/Character/pristine.jpg" width="200" style="border:2px solid #ffd700; border-radius:10px;">
<<elseif _dur gt (_maxDur * 0.5)>>
<img src="images/Character/pristine.jpg" width="200" style="border:2px solid #ffd700; border-radius:10px;"> /* Still looks good */
<<elseif _dur gt (_maxDur * 0.2)>>
<img src="images/Character/torn.jpg" width="200" style="border:2px solid #ffd700; border-radius:10px;"> /* Torn state */
<<else>>
<img src="images/Character/bare.jpg" width="200" style="border:2px solid #ffd700; border-radius:10px;"> /* Fully destroyed */
<</if>>
<<else>>
<img src="images/Character/bare.jpg" width="200" style="border:2px solid #ffd700; border-radius:10px;"> /* Default */
<</if>>
</div>
<</widget>>
<!-- Arena Tournament Widget -->
??
<!--__________________________________________________________________________________________
_________________________ Rumours Widgets _________________________-->
<<widget "WorldRumours">>
/* 1. THE AGING PROCESS: Subtract 1 from any active event timers */
<<if $worldState.activeWar>>
<<set $worldState.activeWar.remaining -= 1>>
/* If timer hits 0, the war ends */
<<if $worldState.activeWar.remaining lte 0>>
<div class="rumour-event">
<strong>◎ Jianghu News ◎</strong><br>
The bloody conflict between the <<print $worldState.activeWar.sideA>> and <<print $worldState.activeWar.sideB>> has finally concluded. A fragile peace returns... for now.
</div>
<<set $worldState.activeWar to null>>
<</if>>
<</if>>
/* 2. TRIGGER NEW RUMOURS (20% chance) */
<<if random(1, 100) lte 20>>
<<set _rumourCategory to random(1, 100)>>
<<set _text to "">>
<<switch _rumourCategory>>
/* --- 1–20: SECT WAR LOGIC --- */
<<case 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20>>
<<if $worldState.activeWar>>
/* Report on the CURRENT war */
<<set _text to `The fields are stained red as the war between **$worldState.activeWar.sideA** and **$worldState.activeWar.sideB** enters another month. ($worldState.activeWar.remaining turns until exhaustion).`>>
<<else>>
/* Start a NEW war */
<<set _sects to ["Clear Sky Azure Dragon Pavilion", "Ghost King Netherworld Sect", "Five Elements Holy Land", "Profound Heaven Sword Alliance"].randomMany(2)>>
/* A war lasts between 1/2 year (12 turns) and 1.5 years (36 turns) */
<<set _duration to random(12, 36)>>
<<set $worldState.activeWar to {
sideA: _sects[0],
sideB: _sects[1],
remaining: _duration
}>>
<<if _sects.includes($playerSect)>>
<<set _text to `**URGENT:** Your sect, ${_sects.find(s => s === $playerSect)}, has declared war! The elders demand blood from the ${_sects.find(s => s !== $playerSect)}!`>>
<<else>>
<<set _text to `The **${_sects[0]}** and **${_sects[1]}** have officially begun a Great Sect War. The region is in chaos.`>>
<</if>>
<</if>>
/* --- 16–30: THE "BORN GENIUS" / SECT POLITICS --- */
<<case 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30>>
<<set _name to ["Young Master Xiao", "Fairy Lingyue", "Sword Madman Huo", "Ghost Hand Xue", "Elder Han's Bastard"].random()>>
<<set _sect to ["Heavenly Sword Sect", "Jade Pure Palace", "Blood Flame Clan"].random()>>
<<if _sect === $playerSect>>
<<set _text to [
`Whispers in the outer courts: **_name** has successfully refined a 'Heart-Severing Pill'. The screams from the dungeon have finally stopped.`,
`Internal politics: Your fellow disciple **_name** was found with a crippled cultivation base. The Elders are calling it 'meditation backfire,' but everyone saw the marks of a forbidden technique.`,
`Promotion: **_name** has been granted the title of Core Disciple. Three other candidates disappeared during the 'selection trial'.`
].random()>>
<<else>>
<<set _text to [
`The **_sect** is hunting for **_name**, a runaway disciple who allegedly stole a fragment of their foundational scripture. A bounty of 10,000 spirit stones—dead or alive.`,
`Travelers claim the **_sect** has blockaded the nearby mountain passes. They are 'testing' the spiritual roots of every traveler; those who fail are sent to the mines.`,
`Rumor has it **_name** of the **_sect** slaughtered an entire branch family of a vassal clan for a 'slight' to their dignity. The blood hasn't washed off the stones yet.`
].random()>>
<</if>>
/* --- 31–45: ANCIENT RUINS & DESOLATION --- */
<<case 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45>>
<<set _zone to ["Blood Sand Reach", "Hundred Sorrows Mountain"].random()>>
<<set _text to [
`The seal on **_zone** has fractured. A miasma of ancient resentment is drifting toward the mortal plains; three villages have already gone silent.`,
`Scouts returned from **_zone** with their eyes gouged out. They keep chanting about an 'Immortal's Grave' that isn't empty.`,
`The Righteous Path has established a perimeter around **_zone**. They claim it is for 'public safety,' but the wagon-loads of looted artifacts tell a different story.`,
`A pulse of dark energy erupted from **_zone**. The local wildlife has mutated, growing teeth of obsidian and a hunger for spiritual qi.`
].random()>>
/* --- 46–60: MARKET & THE COST OF POWER --- */
<<case 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60>>
<<set _text to [
"Spirit stone purity is dropping across the southern markets. Rumors suggest the Great Veins are being over-mined to fund the upcoming war.",
"The black market is flooded with 'Blood Essence' vials. Local graveyards have been desecrated, leading many to suspect a demonic sect is harvesting the dead.",
"A merchant caravan was found slaughtered near the border. Not a single spirit stone was taken—only the children's 'spiritual roots' were harvested.",
"The price of Foundation Establishment Pills has tripled. Small clans are selling their daughters into sect servitude just to afford a single chance at a breakthrough."
].random()>>
/* --- 61–100: GENERAL FLAVOR & OMINOUS MYSTERIES --- */
<<default>>
<<set _text to [
"A wandering cultivator was found hanging from the gates of a mortal city, his skin covered in forbidden seals. A warning from the Ghost King's men.",
"Old Man He from the fishing village says the river ran red for three hours yesterday. He saw shadows beneath the water that didn't belong to fish.",
"A group of rogue cultivators 'purified' a village of suspected plague. They burned it to the ground with the inhabitants still inside.",
"Eerie flutes are heard at night in the pine forests. Those who follow the music are found days later with their souls missing and their bodies intact.",
"A 'Saintess' has appeared in the slums, performing miracles. The local sect is preparing to 'arrest' her for heresy—or perhaps to steal her cultivation method.",
"The sky turned a bruised purple for ten heartbeats today. The birds fell dead from the trees, and the oxen refused to plow."
].random()>>
<</switch>>
/* 3. FINAL OUTPUT */
<<if _text neq "">>
<div class="rumour-event">
<strong>◎ Jianghu Whispers ◎</strong>
<<if _severity is "shocking">><span style="color: #c41e3a;"> (Shocking!)</span><</if>>
<<if $worldState.activeWar>><br><small><i>[STATE: War in Progress]</i></small><</if>>
<br>_text
</div>
<</if>>
<</if>>
<</widget>>
<<widget "TavernGossip">>
<div class="rumour-box" style="border-left: 3px solid #d4af37; padding-left: 10px; margin: 10px 0; background: rgba(255,255,255,0.05);">
<i style="color: #aaa;">You lean back and sharpen your senses, filtering through the clatter of chopsticks and the slurred boasts of drunken men...</i><br><br>
/* Call your existing logic */
<<WorldRumours>>
/* If WorldRumours didn't trigger (the 20% chance), give a default "quiet" message */
<<if _text eq "" or _text eq undefined>>
<span style="color: #888;">The conversations tonight are mundane—mostly complaints about the price of low-grade grain and local tax collectors.</span>
<</if>>
</div>
<</widget>>
<<widget "LogEvent">>
<<set _type to $args[0]>>
<<set _title to $args[1]>>
<<set _description to $args[2]>>
<<set _importance to $args[3] || 3>>
<<set _relatedNPC to $args[4] || null>>
<<set _relatedNPCName to $args[5] || null>>
<<set _entry = {
id: $nextJournalId,
turn: $turns || 0,
age: $lifespan,
type: _type,
title: _title,
description: _description,
importance: _importance,
relatedNPC: _relatedNPC,
relatedNPCName: _relatedNPCName,
location: $region,
timestamp: Date.now()
}>>
<<run $journalEntries.unshift(_entry)>>
<<set $nextJournalId += 1>>
/* Optional: limit journal size to prevent bloat (keep last 200 entries) */
<<if $journalEntries.length gt 200>>
<<run $journalEntries.pop()>>
<</if>>
<</widget>><<widget "GenerateGrudge">>
<<set _victim to $args[0]>>
<<set _action to $args[1]>>
<<set _avengerId to $args[2] || null>>
/* Determine who seeks revenge */
<<set _avenger to null>>
<<set _relationship to "">>
<<if _avengerId>>
<<set _avenger to $known_npc_list.find(function(n) { return n.id === _avengerId; })>>
<<else>>
/* Find a relative or close connection */
<<set _potentialAvengers to []>>
/* Check all known NPCs for relations to victim */
<<for _i = 0; _i lt $known_npc_list.length; _i++>>
<<set _npc to $known_npc_list[_i]>>
<<if _npc.id != _victim.id and !_npc.isDead>>
<<if _npc.relations.lovers and _npc.relations.lovers.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "lover"})>>
<</if>>
<<if _npc.relations.spouses and _npc.relations.spouses.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "spouse"})>>
<</if>>
<<if _npc.relations.parents and _npc.relations.parents.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "child"})>>
<</if>>
<<if _npc.relations.children and _npc.relations.children.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "parent"})>>
<</if>>
<<if _npc.relations.siblings and _npc.relations.siblings.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "sibling"})>>
<</if>>
<<if _npc.relations.masters and _npc.relations.masters.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "disciple"})>>
<</if>>
<<if _npc.relations.apprentices and _npc.relations.apprentices.includes(_victim.id)>>
<<set _potentialAvengers.push({npc: _npc, rel: "master"})>>
<</if>>
<</if>>
<</for>>
<<if _potentialAvengers.length gt 0>>
<<set _selected = _potentialAvengers.random()>>
<<set _avenger = _selected.npc>>
<<set _relationship = _selected.rel>>
<</if>>
<</if>>
<<if _avenger>>
/* Calculate severity based on action and victim's cultivation */
<<set _severity = 0>>
<<switch _action>>
<<case "rape">>
<<set _severity = 8 + Math.floor(Math.random() * 3)>>
<<set _avenger.depravity += 5>>
<<set $demonicreputation += 15>>
<<set $hypocrisyScore += 10>>
<<case "seduction">>
<<set _severity = 3 + Math.floor(Math.random() * 3)>>
<<set $sexFame += 5>>
<<case "murder">>
<<set _severity = 10>>
<<set $demonicreputation += 20>>
<<set $civilians_harmed += 1>>
<<case "humiliation">>
<<set _severity = 2 + Math.floor(Math.random() * 4)>>
<<set $fame -= 5>>
<<case "betrayal">>
<<set _severity = 5 + Math.floor(Math.random() * 3)>>
<<set $hypocrisyScore += 5>>
<</switch>>
/* Create grudge object */
<<set _grudge = {
id: Date.now() + "_" + random(0, 9999),
avengerId: _avenger.id,
avengerName: _avenger.fullname,
victimId: _victim.id,
victimName: _victim.fullname,
type: _action,
severity: _severity,
relationship: _relationship,
location: _victim.NPClocation,
triggered: false,
active: true,
hasGrudge: true,
timer: random(3, 7) /* turns before they act*/
}>>
<<run $activeGrudges.push(_grudge)>>
/* Update avenger's stats */
<<set _avenger.hasGrudge = true>>
<<set _avenger.grudgeTarget = "player">>
<<set _avenger.grudgeType = _action>>
/* Generate message for player */
<<set _grudgeMessage = "✦ A shadow stirs in " + _victim.NPClocation + ". " + _avenger.fullname + " seeks justice for what you did to " + _victim.fullname + "! ✦">>
<<set $lastGrudgeMessage = _grudgeMessage>>
<</if>>
<</widget>>
<<widget "CheckRevengeEvents">>
<<if def $activeGrudges and $activeGrudges.length gt 0>>
<<set _revengeTriggered to false>>
/* Using range to avoid index errors */
<<for _index, _grudge range $activeGrudges>>
<<if _grudge.active and !_grudge.triggered and !_revengeTriggered>>
<<set _grudge.timer -= 1>>
<<if _grudge.timer lte 0>>
<<set _avenger to $known_npc_list.find(function(n) { return n.id === _grudge.avengerId; })>>
<<if _avenger and !_avenger.isDead>>
/* High power NPCs can hunt you across regions! */
<<set _isPowerful to (_avenger.power gt 100)>>
<<set _locationMatch to (_avenger.NPClocation == $region or _grudge.location == $region or _isPowerful)>>
<<set _chance to 15 + (_grudge.severity * 5)>>
<<if _locationMatch>><<set _chance += 25>><</if>>
/* Debug: <<print "Checking grudge for " + _avenger.fullname + " Chance: " + _chance>> */
<<if random(1,100) lte _chance>>
<<set _revengeTriggered to true>>
<<set _grudge.triggered to true>>
<<set $currentRevengeGrudge to _grudge>>
<<set $encounterOriginPassage to passage()>>
<<goto "RevengeEncounter">>
<</if>>
<<else>>
/* If avenger died elsewhere, deactivate the grudge */
<<set _grudge.active to false>>
<</if>>
<</if>>
<</if>>
<</for>>
/* Cleanup: Periodically remove inactive grudges from the array */
<<set $activeGrudges to $activeGrudges.filter(function(g) { return g.active === true; })>>
<</if>>
<</widget>><<widget "gainRandomItem">>
<<set _item = clone(either(...$itemList))>>
<<set _exists = false>>
<<for _i = 0; _i < $playeriteminventory.length; _i++>>
<<if $playeriteminventory[_i].name == _item.name>>
<<set $playeriteminventory[_i].quantity += 1>>
<<set _exists = true>>
<<break>>
<</if>>
<</for>>
<<if not _exists>>
<<set _item.quantity += 1>>
<<set $playeriteminventory.push(_item)>>
<</if>>
<</widget>>
<<widget "AddItemToInventory">>
<<set _found = false>>
<<for _item range $playeriteminventory>>
<<if _item.name == _args[0].name>>
<<set _item.quantity += 1>>
<<set _found = true>>
<</if>>
<</for>>
<<if not _found>>
<<set _newItem = clone(_args[0])>>
<<set _newItem.quantity = 1>>
<<set $playeriteminventory.push(_newItem)>>
<</if>>
<</widget>>
<<widget "craftItem">>
<<set _recipe = _args[0]>>
<<set _canCraft = true>>
<!-- Check to see if enough ingredients -->
<<for _id, _qty range _recipe.ingredients>>
<<set _found = $playeriteminventory.find(function(item) { return item.name == _id })>>
<<if !_found or _found.quantity < _qty>> <!-- If not enough ingredients -->
<<set _canCraft = false>>
<</if>>
<</for>>
<<if _canCraft>>
<!-- Removing ingredients -->
<<for _id, _qty range _recipe.ingredients>>
<<set _item = $playeriteminventory.find(function(item) { return item.name == _id })>>
<<if _item>> <!-- Check to see if item exists -->
<<set _item.quantity -= _qty>>
<<if _item.quantity <= 0>> <!-- If quantity of item is 0, remove it -->
<<set $playeriteminventory = $playeriteminventory.filter(function(item) { return item.name != _id })>>
<</if>>
<</if>>
<</for>>
<!-- Adding result item -->
<<set _existing = $playerpotioninventory.find(function(item) { return item.id == _recipe.result.id })>>
<<if _existing>> <!-- If item already exists, increase quantity -->
<<set _existing.quantity += _recipe.result.quantity>>
<<else>> <!-- If item doesn't exist, create new one -->
<<set _newItem = clone(_recipe.result)>>
<<run $playerpotioninventory.push(_newItem)>>
<</if>>
<!-- Success message -->
<<replace "#craftlog">>You've crafted: <b><<print _recipe.result.name>></b>!<</replace>>
<<else>>
<!-- Message about lack of ingredients -->
<<replace "#craftlog">><span style="color: red;">Not enough ingredients to craft <b><<print _recipe.name>></b>!</span><</replace>>
<</if>>
<</widget>>
basestrength
<<widget "useItem">>\
<<nobr>>
<<if $selectedPotion.quantity gt 0>>
<<set $selectedPotion.quantity to $selectedPotion.quantity - 1>>
/* --- STRENGTH BOOST --- */
<<if $selectedPotion.effect eq "boostStrength">>
<<if $basestrength lt $selectedPotion.maxStatLimit>>
<<set $basestrength to $basestrength + 1>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text">Strength Increased!</span><br>
Your muscles surge with newfound power. Base Strength is now $basestrength.
</div>
<</replace>>
<<else>>
<<replace "#use-log">>
<div class="use-log warning">
Your strength has reached the limit of this pill's efficacy ($selectedPotion.maxStatLimit). No further boost applied.
</div>
<</replace>>
<</if>>
/* --- HEART DEMON NECTAR --- */
<<elseif $selectedPotion.effect eq "raiseCorruption">>
<<set $corruption to ($corruption || 0) + 2>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text demonic">Demonic Essence Absorbed!</span><br>
The sweet nectar burns your throat. Your inhibitions crumble as the Heart Demon whispers in your ear.
Corruption: $corruption.
</div>
<</replace>>
/* --- SUCCUBUS BREATH MIST --- */
<<elseif $selectedPotion.effect eq "boostCharisma">>
<<if $basecharisma lt $selectedPotion.maxStatLimit>>
<<set $basecharisma to $basecharisma + 1>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text">Aura of Seduction!</span><br>
Your voice takes on a rhythmic, hypnotic quality. Others find it harder to look away.
Base Charisma: $basecharisma.
</div>
<</replace>>
<<else>>
<<replace "#use-log">>
<div class="use-log warning">
Your mortal vessel cannot contain more charm; the mist dissipates without effect.
</div>
<</replace>>
<</if>>
/* --- FORBIDDEN YANG SEED --- */
<<elseif $selectedPotion.effect eq "deepCorruption">>
<<set $corruption to ($corruption || 0) + 10>>
<<replace "#use-log">>
<div class="use-log success">
<span class="glow-text demonic">Yang Core Awakening!</span><br>
A violent surge of primal energy explodes in your dantian. Dark patterns flicker under your skin.
Corruption has surged to $corruption.
</div>
<</replace>>
<</if>>
<<else>>
/* --- OUT OF ITEMS --- */
<<replace "#use-log">>
<div class="use-log failure">
<span class="glow-text warning">Meridians remain still...</span><br>
You reach for the pill, but find only an empty jade bottle.
</div>
<</replace>>
<</if>>
<</nobr>>\
<</widget>>
<<widget "LootAfterBattle">>
to-do
<</widget>><<set $playernameList to ["Lianhua", "Meiying", "Ziyan", "Xue'er", "Ruyue", "Yuelian", "Qingxue", "Feiyan", "Huixin", "Ling'er", "Zhilan", "Yunxi", "Shuang", "Yanyan", "Mingyue"]>>
<<set $playersurnameList to ["Bai", "Li", "Feng", "Zhao", "Qin", "Shangguan", "Xu", "Jiang", "Mo", "Yan", "Zhu", "Lan", "Tang", "Luo", "Su"]>>
<<set $internalOptions to ["Selfless", "Upstanding", "Kind", "Wicked", "Selfish", "Evil"]>>
<<set $internalTrait to "">>
<<set $externalOptions to ["Romantic", "Vengeful", "Power-hungry", "Loyal", "Family-oriented", "Carefree", "Glory hound", "Self centered"]>>
<<set $externalTrait to "">>
<<set $NPCinternalOptions to ["Selfless", "Upstanding", "Kind", "Wicked", "Selfish", "Evil"]>>
<<set $NPCexternalOptions to ["Romantic", "Vengeful", "Power-hungry", "Loyal", "Family-oriented", "Carefree", "Glory hound", "Self centered"]>><<widget "NpcTalk">>
<<if $currentNPC.friendship lt 20 and $currentNPC.talk lt 3>>
<<set _random_desc_1 = $neutralTalkNPC.pluck()>>
_random_desc_1
<<set $neutralTalkNPC to [
"You look like a new face around here.",
"Not many travelers pass through this area.",
"What brings you to this place?",
"Be careful. Not all cultivators are as kind as they appear.",
"The spiritual energy feels dense today, doesn't it?"
]>>
<</if>>
<<if $currentNPC.friendship gte 30 and $currentNPC.friendship lt 70>>
<<set _random_desc_1 = $friendlyTalkNPC.pluck()>>
_random_desc_1
<<set $friendlyTalkNPC to [
"It’s always good to see a friendly face.",
"Training hard again? You never take a break.",
"I found a quiet spot by the waterfall—you’d love it.",
"Let me know if you ever need help with your cultivation.",
"The sect's been talking about your progress. You're not bad."
]>>
<</if>>
<<if $currentNPC.relationshipType eq "lover" and $currentNPC.hadSex eq 1>>
<<set _random_desc_1 = $loverTalkNPC.pluck()>>
_random_desc_1
<<set $loverTalkNPC to [
"I dreamed of you last night…",
"Come closer. I want to feel your presence.",
"You always make my heart feel lighter.",
"After everything, I’m glad we met.",
"When this world turns to chaos, remember you have me."
]>>
<</if>>
<<if $currentNPC.depravity gt 70>>
<<set _random_desc_1 = $highDepravityTalkNPC.pluck()>>
_random_desc_1
<<set $highDepravityTalkNPC to [
"Power is the only language worth speaking.",
"Desire isn't a weakness—it's fuel.",
"Have you ever killed someone and felt… exhilarated?",
"Kindness? That's a lie we tell ourselves.",
"I could show you things you'd never forget… if you're brave enough."
]>>
<</if>>
<<if $currentNPC.mentorshipType eq 1>>
<<set _random_desc_1 = $MentorTalkNPC.pluck()>>
_random_desc_1
<<set $MentorTalkNPC to [
"Your stance is improving. Slightly.",
"Discipline, focus, and patience—that’s the path.",
"Did you review the techniques I assigned?",
"Even a spark can become a flame. Don’t waste your potential.",
"I was once like you… hungry for power, blind to the cost."
]>>
<</if>>
<<if $currentNPC.mentorshipType eq 2>>
<<set _random_desc_1 = $ApprenticeTalkNPC.pluck()>>
_random_desc_1
<<set $ApprenticeTalkNPC to [
"Master, do you think I’m ready for the next realm?",
"I tried the technique you showed me, but something feels off.",
"Thank you for taking me in. I won’t disappoint you.",
"Sometimes I wonder why you chose me.",
"Your teachings… they saved me more than once."
]>>
<</if>>
<<if $currentNPC.relationshipType eq "enemy">>
<<set _random_desc_1 = $enemyTalkNPC.pluck()>>
_random_desc_1
<<set $enemyTalkNPC to [
"Still alive? Disappointing.",
"One day, I’ll surpass you. Count on it.",
"Don’t think I’ve forgotten what you did.",
"You may have power, but you lack honor.",
"Every time we speak, I lose more respect for you."
]>>
<</if>>
<<if $currentNPC.talk gt 10>>
<<set _random_desc_1 = $highTalk.pluck()>>
_random_desc_1
<<set $highTalk to [
"You’ve changed since we first met.",
"Talking to you always makes things clearer.",
"Strange… I never thought I’d trust someone like you.",
"So much has happened, hasn’t it?",
"Even in silence, your presence comforts me."
]>>
<</if>>
<</widget>><<set $playerJuniorSexBeg to [
"Please… touch me. I need it so badly.",
"Don’t tease me anymore… I’ll do anything.",
"I want it—your hands, your mouth—just *please*…",
"Make me yours. I can’t wait anymore…",
"Please, Junior… I’m aching for you.",
"I’ll be good. Just touch me, please.",
"You win… Just don’t stop now.",
"I’m all yours—just take me already.",
"I need you. Right here. Right now."
]>>
<<set $submissiveDialogueNPC to [
"Ah—fuck, you’re so tight, I can barely handle it…",
"Please… don’t stop… I need it, I need all of you—",
"Senior, I’ll do anything—just don’t stop using me like this—",
"Gods, you’re milking me so good… I can’t think—",
"I’ll cum if you keep going like that—please, not yet—",
"Your pussy’s squeezing me so hard—I can’t last like this, fuck…"
]>>
<<set $dominantDialogueNPC to [
"Take it. Every inch—I want you stuffed full of me.",
"You’re dripping for me. You were made for this cock, weren’t you?",
"So needy, so fucking wet—I could do this all day.",
"Look at you. Fucked dumb on just my cock.",
"I’ll ruin you for anyone else—no one will ever fill you like I do.",
"Keep moaning like that and I’ll make you scream my name, slut."
]>>
<<set $neutralDialogueNPC to [
"Gods, you feel incredible… so warm, so tight…",
"Every time I slide in, it’s like the first time.",
"You fit me perfectly—I never want to stop.",
"Your pussy’s so good… I could lose myself in you.",
"I love watching your face when I push inside.",
"You're amazing… fuck, don’t stop clenching like that…"
]>>
<<set $submissiveDialoguePC to [
"Yes—please, keep going, don’t stop—",
"You’re so deep… gods, I can’t take much more—",
"I’m yours—just fuck me however you want—",
"Ah—ah! You’re stretching me so good—",
"Harder—please, just a little more, I can take it—",
"I love it when you take control—use me—"
]>>
<<set $dominantDialoguePC to [
"You like being inside me, don’t you? Pathetic.",
"This pussy owns you now. Say it.",
"You’ll cum when I say so. Not a moment sooner.",
"Beg for it. Beg to stay inside me.",
"Keep moaning—I want to hear how desperate you are.",
"You're lucky I'm letting you fuck me at all."
]>>
<<set $neutralDialoguePC to [
"Yes… right there… gods, that feels so good—",
"Don’t stop, you feel perfect inside me—",
"Deeper… fuck, that’s it—",
"I want to feel every inch… don’t hold back—",
"You’re hitting all the right spots—don’t stop now—",
"So good… I could fuck you like this forever—"
]>>
__________________________________________________________________________________________
_________________________ARROGANT YOUNG MASTER__________________________________
__________________________________________________________________________________________
<<set $vagDoggyArrogantYMdesc = [
"He fucks you hard — hands gripping your hips, teeth at your neck, hips slamming into you with practiced cruelty. Every thrust is punctuated by some mocking praise.",
"His cock drives deep from behind, your ass slapping against his hips with every punishing thrust. He uses you like a toy, panting with pleasure as he dominates you.",
"You feel completely exposed as he takes you from behind, one hand on your neck and the other spanking your ass between thrusts. There's no gentleness — just raw, possessive force.",
"He grabs your hair and pulls you back as he thrusts deeper. Your cries only make him grin harder — you’re being claimed, over and over again.",
"Bent over with your face pressed to the bedding, you can only moan as he ruts into you like a beast in heat. He fucks like he owns you, and in this moment, maybe he does."
]>>
<<set $vagArrogantYMtalks = [
"You moan like a whore.",
"Maybe I’ll keep you here. You’d look perfect leashed beneath my desk.",
"I knew you’d be good on all fours.",
"You're dripping like a bitch in heat. Don't pretend you're not loving this.",
"Say thank you, slut — thank me for fucking you.",
"No one's going to fuck you like this again. I ruin everything I use.",
"You're not even trying to resist anymore. Good. Know your place.",
"Do you like being used by someone above your station?"
]>>
<<set $vagArrogantYMcumCreampie = [
"With a final, brutal thrust, he buries himself deep — your walls clamp around him just as hot spurts of cum flood your pussy. He grunts, grinding in to make sure it all stays inside.",
"He slams in and holds you tight, cock twitching as he fills you. Warm, thick seed spills deep, and he sighs in satisfaction like he just claimed a prize.",
"You feel his cock throb deep inside, and then the hot rush of release. His cum leaks from you almost instantly, but he stays buried, as if daring it to escape.",
"His rhythm falters, then stops — and he groans low as he spills into you. You can feel every pulse, every drop marking you from the inside.",
"He fucks you straight through his climax, pumping cum into you with each lingering thrust. It’s messy, filthy, and he clearly loves it that way."
]>>
<<set $vagArrogantYMcumTalkCreampie = [
"That's where you belong — dripping full of me.",
"Hope you weren’t planning on using that hole for anyone else.",
"Mmm. You feel better wrapped around my cock than anyone else has.",
"I’ll leave it in for a while — wouldn’t want it leaking out too soon.",
"Consider yourself claimed. You’ll be smelling like me for days."
]>>
<<set $ArrogantYMcumMouth = [
"He shoves your head down, groaning as he cums. Hot, bitter seed hits the back of your throat in thick spurts, and he doesn’t let you up until you’ve swallowed every drop.",
"His cock pulses against your tongue as he fills your mouth. You can’t help but gag slightly, but he just grins and tells you to keep going — to take it all.",
"He moans low and steady, holding your head tight as he cums directly into your mouth. You’re left with no choice but to swallow or choke.",
"Warm cum floods your mouth as he finishes, and you can taste every humiliating drop. He pulls out slow and wipes the tip against your lips.",
"He cums hard, and you feel it fill your mouth almost instantly. It drips down your chin as he laughs and wipes the excess across your cheek."
]>>
<<set $vagArrogantYMcumTalkMouth = [
"Swallow it all. Don’t waste a drop.",
"Good whore. Maybe I’ll let you taste it again sometime.",
"You make a decent cumdump, I’ll give you that.",
"Open wider next time. I want to see it pool on your tongue.",
"Keep your mouth open. I’m not done using it."
]>>
<<set $ArrogantYMcumFace = [
"He jerks himself fast, then tilts your chin up — hot ropes of cum splash across your cheeks, lips, and nose. You feel it drip as he smirks.",
"With a low grunt, he strokes out thick spurts that land across your face — some hitting your forehead, others your lips. You’re painted in disgrace.",
"His cock twitches in his grip, then he releases — warm cum hitting your face in wet splashes, some getting in your hair. He looks proud of the mess.",
"You close your eyes just in time. Cum streaks across your face, running down your jaw and onto your collarbone. He chuckles and calls it an improvement.",
"He holds your face steady, aiming every pulse of cum directly onto your features. You're left dripping, sticky, and humiliated — just how he likes it."
]>>
<<set $vagArrogantYMcumTalkFace = [
"Now that’s a good look for you. So fucking pretty like this.",
"Smile for me. Let everyone see how I decorated you.",
"Stay still. I want to admire my work.",
"That’s what your face is good for — catching my cum.",
"Wipe it off? No. Walk around like that. Let them know."
]>>
<<set $vagCowgirlArrogantYMdesc = [
"He pulls you into his lap, your back to his chest, and forces you down onto his cock, letting you ride him like a toy built for his pleasure.",
"His hand cracks down on your ass, sharp and loud, leaving a red mark that stings with each bounce.",
"You feel his cock throb deep inside as he guides your hips, fucking you from beneath while you moan helplessly."
]>>
<<set $vagArrogantYMtalks = [
"Louder. I want everyone outside to hear what a good whore you are.",
"You ride like you've done this before — don't lie to me.",
"That ass will carry my handprint for days. Perfect.",
"I could sit here all night and let you fuck yourself stupid on my cock."
]>>
<<set $analProneArrogantYMdesc = [
"He shoves your face down into the cushion, lifting your hips and exposing your hole before pushing inside slowly, stretching you open inch by inch.",
"Each thrust is hard and deep, his hips smacking against your ass while your moans are muffled in the fabric beneath you.",
"He leans over your back, breathing hotly into your ear as he pounds into your ass like he owns it."
]>>
<<set $analArrogantYMtalks = [
"Face down, ass up — just how I like my pets.",
"You’ll feel this every time you sit, and you’ll remember who did it to you.",
"Even your tight little hole can't resist me.",
"You're nothing but a hole for my pleasure now. Accept it."
]>>
<!-- Alchemy Vendor -->
<<set $azureCauldronChat = [
"The finest elixirs demand the purest flame and the rarest herbs—patience is the true ingredient of immortality.",
"This Qi Gathering Pill was refined under three full moons; one swallow, and your meridians will sing with power.",
"Beware cheap pills from wandering peddlers—their impurities will clog your dantian like mud in a river.",
"A true alchemist does not chase breakthroughs; he coaxes them, gently, like courting a shy spirit beast.",
"Bring me fresh Spirit Ginseng and Crimson Lotus petals, and I shall brew something worthy of your destiny."
]>>
<!-- Weapon Vendor -->
<<set $thunderClapChat = [
"A sword is merely iron until it drinks the blood of its wielder's resolve—choose your blade wisely.",
"This Heavenly Edge was forged in thunder-fire; it hungers for the heavens themselves.",
"Sharpness alone is not enough—a true weapon must resonate with its master's qi, or it is just cold steel.",
"Your stance tells me you favor swift strikes; this Willow-Leaf Saber would dance in your hands like wind through leaves.",
"Bring me the core of a Core Formation beast, and I will reforge your weapon into something legends fear."
]>>
<!-- Shady NSFW Vendor -->
<<set $blissFurnaceChat = [
"Desire is the purest furnace—let it burn away your inhibitions, and your qi will flow freer than ever.",
"A single drop of Phoenix Tears Oil on sensitive skin… and even the sternest cultivator melts into blissful surrender.",
"True dual cultivation begins with trust; relax your body, open your meridians, and let pleasure guide the energy.",
"This jade rod hums with warm yang qi—used properly, it will temper your foundation in ways no ordinary pill ever could.",
"Come to the back when you're ready; Mei Ling's hands know exactly where your tension hides… and how to release it."
]>>
<<set $playerSexLinesCorrupt to [
"Ahh~ Master, harder!",
"Fuck me until I break...",
"Use me like your whore!",
"I'm your cum dump~",
"Fill my slutty hole!",
"Destroy me, please...",
"I need it rough!",
"Make me scream your name!"
]>>
<<set $playerSexLinesNormal to [
"Ahh~",
"Yes—!",
"More... please",
"Harder!",
"Don't stop...",
"Mmmph~",
"Oh heavens...",
"Right there!",
"You're so deep..."
]>>
<<set $playerSexLinesPure to [
"Ah...!",
"It's too much...",
"Be gentle...",
"Mmm...",
"Oh... yes",
"I-I can't...",
"Please be careful...",
"You're... so big"
]>><<set $breakthroughMethod to "">>
Player starts at *Body Tempering Realm* *Early*
<--Body Tempering Realm to Meridian Awakening Realm -->
*Mortal Path*
Items needed : One Earthly Treasure
*Earthly Path*
Items needed : Three Earthly Treasure
*Heavenly Path*
Items needed : 6 Earthly Treasure
<<set $azureserpentscale to {"name": "Azure Serpent Scale", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "A shimmering scale from an ancient serpent that dwells deep in the misty mountains.", "id": "azureserpentscale"}>>
<<set $moonlitorchidnectar to {"name": "Moonlit Orchid Nectar", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "Collected from a rare orchid that blooms only under the full moon’s light", "id": "moonlitorchidnectar"}>>
<<set $emberheartstone to {"name": "Emberheart Stone", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "A fiery gemstone born from volcanic flames, radiating warmth and vitality.", "id": "emberheartstone"}>>
<<set $silentphoenixfeather to {"name": "Silent Phoenix Feather", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "A single feather from the elusive phoenix, symbolizing rebirth and perseverance.", "id": "silentphoenixfeather"}>>
<<set $ghostvineroot to {"name": "Ghostvine Root", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "The twisted root of a plant growing in haunted forests, infused with mysterious energy.", "id": "ghostvineroot"}>>
<<set $celestialdewdrop to {"name": "Celestial Dewdrop", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "A rare drop of dew gathered from the leaves of a divine tree", "id": "celestialdewdrop"}>>
<<set $windqi to {"name": "Wind Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "The essence of the restless wind.", "id": "windqi"}>>
<<set $flameqi to {"name": "Flame Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "The blazing essence of fire.", "id": "flameqi"}>>
<<set $stormqi to {"name": "Storm Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "Charged with the crackling energy of lightning.", "id": "stormqi"}>>
<<set $spiritqi to {"name": "Spirit Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "A pure, refined Qi that heightens awareness and focus.", "id": "spiritqi"}>>
<<set $earthqi to {"name": "Earth Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "The grounding energy of the earth.", "id": "earthqi"}>>
<<set $frostqi to {"name": "Frost Qi", "strength": 0, "agility": 0, "willpower": 0, "armor": 0, "health": 0, "energy": 0, "evadescore": 0, "price": 150, "tripleprice": 450, "sellprice": 400, "class": "item", "quantity": 0, "description": "The frozing essence of ice", "id": "frostqi"}>><<widget "MainMissionStart">>
<<if $mainStageStarted eq "false">>
<<set _chance to (0,100)>>
<<if _chance gt 50>>
As you move through the dense forest on the map, something unusual catches your eye. A faint glow pulses from behind a cluster of ancient rocks nearby.
Do you want to investigate?
<<link "Yes" "MainMissionStart">><<set $pe to 0>><</link>>
<</if>>
<</if>>
<</widget>>
<<widget "MainMissionStage1">>
<</if>>
<</if>>
<</widget>><<if $pe eq 1>>
<<GenerateFamilyBatch>>
<<set _enemy = $encounterBatch[$encounterMainID]>>
<p>A youth smirks at you. He wears the crest of the <b>_enemy.surname Clan</b>.</p>
<<link "Add this arrogant fool and his family to your Book of Connections">>
/* Safely move them from the temporary batch to your permanent list */
<<for _id, _npcObject range $encounterBatch>>
/* Assuming $known_npc_list is an array of objects.
Even better would be making it an Object/Dictionary! */
<<run $known_npc_list.push(_npcObject)>>
<</for>>
<<replace "#result">><span class="gold">Added to your records!</span><</replace>>
<</link>>
<div id="result"></div>
<<link "go back">><<goto "Map|Region1">><</link>>
<</if>>